IEnumerable vs. ICollection vs. IQueryable vs. IList

Collections are used quite often in applications and C# have different types of collection. Here are the subtle differences between collection types and choose appropriate type based on your needs.

IEnumerable: Provides Enumerator for accessing collection

Read more

In-place and out-of-place list sorting in C#

You may need to sort C# list elements in-place sometimes or copy elements of a list to another list according to some sort order (which is in fact another way to sort list elements). Linq provides an easy way to achieve both purposes. Let’s say you have a Project entity with FirstName property.

Read more

Get a C# property name as a string

Recently I came across a situation where I need to pass the name of a property as a string to a constructor. I realized that there is not any in-built framework property or method to achieve so. It makes sense too because the compiler interprets Property Type instead of Property Name. The Property name is for writing human readable (or understandable) code.

If you use this.PropertyName.ToString() then it will convert the value of PropertyName property to string not the name of the property itself.

Read more

Building an ASP.net MVC 4 website

I joined Motorola Solutions as a Summer Intern in May and was given an assignment to build a full-fledge website from scratch which will be used by a whole department internally. It was an independent development assignment while working with stakeholders. I was given freedom in technology decision as stakeholders were majorly interested in end-product not the intrinsics.

With Freedom Comes Responsibility

Read more