What is the Extension Method in C#?

Read full article on Infragistics blog I often get questions about the Extension Method in C#. The Extension Method was introduced in C# Version 3.0. and allows us to add functionalities in an existing class without modifying it, extending it, or re-compiling it. Essentially, the Extension Method allows us to add a new method to … Continue reading What is the Extension Method in C#?

C-Sharp Basics: What is Checked and Unchecked operations

You may have come across questions, What is checked and unchecked primitive operations? How to handle overflow in C-Sharp? Does CLR handles overflow or developers? So let us start with understanding a program. Consider the code listed below:   On running you will get 44 as the output. There is one serious observation about the … Continue reading C-Sharp Basics: What is Checked and Unchecked operations

Exception Filters in C-Sharp 6.0

So far we deal with the Exceptions as below. As you see in the following code snippet, we are catching the exception and displaying the error message. Challenge in the above snippet is that you cannot apply filter to the exception. Of course you can have if-else statement inside the try catch block but it … Continue reading Exception Filters in C-Sharp 6.0

Using AutoMapper : Getting Started

Read full article on Falafel blog I have often seen developers use the LINQ SELECT statement to create a new instance of one class from an existing instance of another class. There are many scenarios when you may have to do this, for example: Creating the domain class instance from the entity class instance Creating … Continue reading Using AutoMapper : Getting Started

Convert List to List using ConvertAll in C#

I see many developers convert one list to another list using foreach. It is ok and get the job done but there is better way to convert one list to another list using ConvertAll(); Just to explain you scenario better, let us assume you got two classes as below. InternalStudent class is representing Student class … Continue reading Convert List to List using ConvertAll in C#