LINQ is of different types based on the source of data.For example for querying in-memory data sources or collections LINQ to objects is used. LINQ to objects is used for querying collections such as List<T>.Any collection which implements IEnumerable<T> or IEnumerable interfaces can be queried using LINQ. Arrays can be querid using LINQ queries since it […]
LINQ Tutorial
Intersect() method in C#
Intersect() method in C# is an extension method.It applies the set theory of mathematics.In set theory the Intersect method returns the common elements of two sets. Similarly the Intersect method returns the common elements in two collections.It is defined in the namespace System.Linq For example if we define two lists as: IList<int> intList1 = new […]
Sorting and selecting top n rows in a group using in LINQ in C#
Here we will see how we can sort rows in a group using LINQ.Also we will select only the top n rows in a group. This is useful in scenario where we are working on data which consists of different groups.For Sorting and selecting top n rows in a group using in LINQ in C# we […]
LINQ Interview Questions and Answers
What is LINQ? LINQ stands for Language Integrated Query.Before LINQ developers have to use different technologies when working with different data sources. For example to query databases developers have to use SQL.To query XML they need to use XPath.LINQ enables us to use the same language which we use to develop our application ,to query data […]
Map different Lists using LINQ in C#
LINQ provides us operator for different tasks such as selection,filtering,ordering.Usually we filter and select the same type as the original type when working with LINQ. In many scenarios we want to filter and map items to a different list type.For example we are performing LINQ operations on a list of type Product and we want to […]