prints strings where each element has the second letter 'i'.

image_pdfimage_print
   
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {

        string[] digits = { "ziro", "one", "two", "three"};

        var reversedIDigits = (
            from d in digits
            where d[1] == 'i'
            select d)
            .Reverse();
        foreach (var d in reversedIDigits) {
            Console.WriteLine(d);
        }
    }
}

    


This entry was posted in LINQ. Bookmark the permalink.