CSharp Articles

LINQ Simplified

Anonymous Method , Lambda Expressions and LINQ in C# 3.0

LINQ stands for Language Integrated Query.

List contains flower name below  :

List flowerList = new List();
flowerList.Add(“ROSE”);
flowerList.Add(“VIOLET”);
flowerList.Add(“ORCHID”);

LINQ Lists – Anonymous Delegates

string flowerRose = flowerList.Find(delegate ( string flower ) )
{
return flower = “ROSE”;
}
);

LINQ Lists – Lambda Expressions

string roseFlower = flowerList.Find((string flower ) => flower.Equals(“ROSE”));

LINQ Lists – Linq Query

var flowerR = from string flower in flowerList
                    where flower == “ROSE”
                    select flower;

Leave a Reply