Hasan Akpürüm
blog-post-1

Linq Select Transformation

public void Linq8() {
    int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
    string[] strings = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };

    var textNums =
        from num in numbers
        select strings[num];

    Console.WriteLine("Number strings:");
    foreach (var str in textNums) {
        Console.WriteLine(str);
    }
}
Sonuç :
Number strings:
five
four
one
three
nine
eight
six
seven
two
zero

Yorum Yaz