An Extensive Examination of LINQ: Extension Methods, Implicitly Typed Variables, and Object Initializers
Content Aggregated From: 4guysfromrolla.com
One of the more substantive additions to the .NET Framework 3.5 and C# 3.0 and Visual Basic 9 languages was LINQ, a set of classes along with language enhancements that allow developers to use a common library and SQL-like query syntax to work with common data stores. The initial article in this series, An Introduction to LINQ , provided an overview of LINQ and its core pieces: the standard query operators, the language extensions that allow for LINQ’s query syntax, and LINQ providers. We also looked at some simple LINQ examples using both the standard query operators and the query syntax. LINQ’s standard query operators – Select , Where , OrderBy , Average , and so on – can be used as if they were instance methods of any object that implements IEnumerable<T> . For example, given a string array named FileNames we can determine how many strings in the array start with the letter “S” by using the Where and Count standard query operators like so: string[] FileNames = { … }; int count = FileNames. Where(name => name.StartsWith(”S”)).Count() ; The Where method and Count methods look like they are members of the Array class.
Read more…















Leave a Reply
You must be logged in to post a comment.