Tag Archives: LINQ

C# Yield Statement Demystified With Examples

The yield statement has been released with .NET 2.0 framework, but many still do not know what it does. In a nutshell, it does transformations – obtaining a result dataset given an input dataset. Since the time yield has seen … Read More »»»

Posted in .NET | Tagged , , , , , , , , | Leave a comment

How Can I Use a LINQ Lambda Expression With Distinct()?

Contrary to what most of other LINQ extension methods provide when dealing with collections of objects, the Distinct() method takes in an object of a class that implements IEqualityComparer<T> interface. When selecting distinct objects, you probably are thinking about having … Read More »»»

Posted in C#, LINQ | Tagged , , , , , , | Leave a comment

How to Get Distinct Values From a LINQ Query

Ever wondered how to get a distinct value set from a LINQ query? Maybe you got that query from a database: var q = dataSet.Tables[0].AsEnumerable(); Or maybe it’s a query on a LINQ query: var q = from oq in … Read More »»»

Posted in Basics | Tagged , , , , , , | Leave a comment

What is an Aggregate in LINQ?

An aggregate is simply a result of an initial value that accumulates operations defined by you on its currently running value. Simply speaking, if you have a variable with an initial value, and a collection of objects, you can add … Read More »»»

Posted in LINQ | Tagged , , , , , | Leave a comment

What is Lambda Expressions? Basics Explained.

You keep wondering what it is and it may scare you at first. It is quite simple, in fact, just another thing to understand. Lambda expressions can certainly be complex, but, start with a simple q => q.A == a; … Read More »»»

Posted in Basics | Tagged , , , , , , | Leave a comment