Hasan Akpürüm
Kıdemli Yazılım Danışmanı
Makele Detayı

Linq Reverse

30.6.2012 11:42:00
public void Linq39() {
    string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };

    var reversedIDigits = (
        from digit in digits
        where digit[1] == 'i'
        select digit)
        .Reverse();

    Console.WriteLine("A backwards list of the digits with a second character of 'i':");
    foreach (var d in reversedIDigits) {
        Console.WriteLine(d);
    }
}
Sonuç : Sadece ikinci harfi 'i' olanları çekmiş olduk.
A backwards list of the digits with a second character of 'i':
nine
eight
six
five
Yorum yaz

Thanks, your message is sent successfully.