ASP.NET Tutorial/LINQ/LINQ — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 11:58, 26 мая 2010

The C# language supports the following clauses that you can use in a query:

from, where, select, group, into, orderby, join, let
var results = from w in words
  where w.Contains("z")
  select w;

is translated into this query by the C# compiler:
var results = words.Where( w => w.Contains("z") ).Select( w => w );


Understanding LINQ

var words = new List<string> {"zephyr", "apple", "azure"};

var results = from w in words
  where w.Contains("z")
  select w;

the results variable will contain the following list of two words:
zephyr
azure