class SimpQuery {
static void Main() {
int[] nums = {.1, -2, 3, 0, -4, 5 };
// , var posNums = from n in nums where n > 0 select n;
Console.Write(" nums: ");
// , foreach(int i in posNums) Console.Write(i + " ");
Console.WriteLine();
}
}
.
nums: 1 3 5
, , nums. , LINQ. .
.
LINQ System.Linq.
nums int. C# IEnumerable<T>. C# , LINQ.
, nums .
var posNums = from n in nums where n > 0 select posNums . , . var posNums . , posNums . , ( IEnumerable<T>). posNums .
from, . , . . ( nums). . int. from.
from _ in _
where, , , . where.
where _
_ bool. . where. where.
where n >
, . > 0 . , . , where , .
|
|
select group. select, , . , , . , , where. ,
. , . , select , . .
, posNums , . , , . , , , . posNums , .