Beginner’s Guide to Value and Reference Types in C#

Value Type: Built in types such as int(all numeric types),char,bool etc.. would come under value type. Custom struct and enum would also fall into this category. Value types exhibit following characteristics. Actual Value(s) gets copied when a variable  is assigned to another variable and there is no relationship between two variables after the assignment statement Consider the following code block …

Sorting a Gridview dynamically on multiple columns in different order in ASP.Net

Most of the ASP.Net developers would have used Gridview control in their applications. This article explains about sorting the gridview dynamically on multiple columns in different order in web applications. I am using Product table of AdventureWorks database for this sorting. Our objective is to achieve the sorting order ListPrice desc, ReOrderPoint asc, Name desc on a gridview which fetches …

LINQ – Basics

Linear INtegrated Query (LINQ) is a set of .Net libraries which gives querying capabilities on local and remote data sources. The data sources can be local such as collection, list, xml  or remote such as databases. In this article, I am going to discuss only about LINQ with local data sources. Before looking into the concepts of LINQ in detail, …

Using Entity Framework Code First approach on existing databases

Most developers prefer Code First style when they use entity framework in their applications. This approach was being primarily used for new applications as it would be difficult to code all the classes for the respective tables when dealing with existing database with lots of tables. But with the advent of Entity framework power tools, you can use Code First …

Adding methods to existing classes in C#

There are many times when we might want to add functionality to existing code. The existing code could be the classes written by  fellow developers in our team or it could be third party code that we might want to use. The obvious choice is to create a new class by inheriting the existing class and add functionality to this …