Posts

Showing posts from September, 2008

LINQ Basic

LINQ BASIC I am starting from this mail to show the technical skills to work with LINQ . The following is a very basic LINQ Query Expression Example: string[] strCities = { "Mumbai", "Delhi", "Surat", "Chennai", "Ahemdabad", "Jaipur" }; IEnumerable strResult = from city in strCities select city.ToUpper(); grdLinqBasic.DataSource = strResult; grdLinqBasic.DataBind(); In the above Example I am using the array of string and then using LINQ query expression against the array. I am also applying a string operation in the query itself, which help us to modify the result in the query itself. LINQ queries return results of type: IEnumerable Where is determined by the object type of the “select” clause of the query. In the above sample “city” is string. So the above example have the IEnumerable type is “string”. LINQ is STORNGLY-TYPED It means we can have compile-time c