Wednesday, September 28, 2011

Types of LINQ syntax


There are 2 types of LINQ Syntax:

  1. 1.Fluent syntax
  2. 2.Query syntax

string[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" };
IEnumerable<string> query =
names.Where (name => name.EndsWith ("y"));
query.Dump ("In fluent syntax");

query =
from n in names
where n.EndsWith ("y")
select n;
query.Dump ("In query syntax");

No comments:

Post a Comment