Tag Archives: LINQ

How to use SelectMany with LINQ JOINS

By | March 9, 2011

  SelectMany is Projects each element of a sequence to an IEnumerable and flattens the resulting sequences into one sequence.In this post I am going to show how you can use SelectMany Extension method to achieve the join between related tables easily without writing long queries. To understand this consider example below As shown in above image customer… Read More »

Find duplicate with Linq

By | March 5, 2011

This small tips discussed about how to get list of duplicate items for the collection that we do in sql. For example I have to get list of the email id which is get entered in user table more than one time. Linq query work same as on the set of collection and which make use of count… Read More »

How to Sort Generic List Using Lambda Expression For Dynamic Type And Dynamic Property ?

By | March 4, 2011

This tips explained how to write a code which is flexible and generic enough to sort any type of collection and also the property based on which it has to be sorted will be dynamic.This is very much easy to hit this requirement using Lamda Expression. Below code will do this for you. We will call this method… Read More »

Multiple Sort For Collection Using LINQ

By | March 1, 2011

There are quite a lot of instance where you need to do a primary sort and you need a secondary sort on the same collection and sometimes even multiple sort. With LINQ we can achieve it pretty straight forward. Let us assume the situation here. We have a list of employees and we need the output to be… Read More »

How to sort ASP.NET DropDownList based on DataValueField or DataTextField using LINQ?

By | January 8, 2011

Sorting ASP.NET Dropdown list is very common requirement for any of the web application development. To Implement this features sometimes developers used to iterate through each and every item and create a sorted list of element then reassign the same source to dropdownlist or sort the element at source itself. But this thing can be done easily using… Read More »