Linq Example 7 : Take

3:35 AM
Linq Query: 

//Take Example
            string[] strAlphabets = { "a","b","c","d","e","f"};

            var strFirstFour = strAlphabets.Take(4);

            foreach (var t in strFirstFour)
            {
                Console.WriteLine(t.ToString());
            }


Output:

a
b
c
d
It simply Take First 4 strings from strAlphabets .

0 comments:

Post a Comment