Tips & Tricks on ASP.NET MVC, Ajax, jQuery, Entity Framework

Entries for the ‘C# 4.0’ Category

How to Convert DataTable to Collection of Custom Class object

Imagine you have a DataTable with Records and you want to Convert that to a List of your Custom class objects ? how do you do that ? The normal -straight forward way is to Loop through  each DataRow, Create a new instance of Custom class object, read the column values of the current row(iterator) [...]

WebImage.Resize method – How to Remove the Left and Top border from the image

WebImage is a class in System.Web.Helpers  namespace ( in System.Web.Helpers dll) which helps us to do some useful things with an image in a webpage like cropping, resizing,flipping ( vertical & horizontal), rotating etc… It is a very useful class if you are working with some code which returns an image  according to your needs [...]

Country State List default data in XML format

If you are looking for the country state list (list of Countries and it’s corresponding States) , here it is.  You can download the XML file here which contains the Countries and it’s States. I used this to fill  my Country and State tables for the OSS project i am working on. It has got 252 [...]

dynamic type in C#.4.0 Where and how to use ? How does it differ from var and object ?

Recently i was working on an API project where i have to return JSON data to the client for different kind of Requests like Customers, Orders, Products etc.  Since i was working on ASP.NET MVC, I could make use of the Json method to convert my entities ( Customer / Product etc…) to Json format [...]