Csharp/C Sharp/LINQ/Projection — различия между версиями

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

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

Projection Operators: do calculation in select statement

<source lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; public class MainClass {

   public static void Main() {
       int[] numbers = { 5, 4, 1, 3, 9};
       var numsPlusOne =
           from n in numbers
           select n + 1;
       Console.WriteLine("Numbers + 1:");
       foreach (var i in numsPlusOne) {
           Console.WriteLine(i);
       }
   }

}

</source>