background preloader

C# .net stuff

Facebook Twitter

Lambda Expressions (C# Programming Guide) Query Expression Basics (C# Programming Guide) A query is a set of instructions that describes what data to retrieve from a given data source (or sources) and what shape and organization the returned data should have.

Query Expression Basics (C# Programming Guide)

A query is distinct from the results that it produces. Generally, the source data is organized logically as a sequence of elements of the same kind. A SQL database table contains a sequence of rows. Similarly, an ADO.NET DataTable contains a sequence of DataRow objects. In an XML file, there is a "sequence" of XML elements (although these are organized hierarchically in a tree structure). Query Expression Basics (C# Programming Guide) Yield Return Example. .NET Array Dictionary List String 2D Async DataTable Dates DateTime Enum File For Foreach Format IEnumerable If IndexOf Lambda LINQ Parse Path Process Property Regex Replace Sort Split Static StringBuilder Substring Switch Tuple Yield interacts with the foreach-loop.

Yield Return Example

It is a contextual keyword: yield is a keyword only in certain statements. It allows each iteration in a foreach-loop be generated only when needed. In this way it can improve performance.Example.