Ordering in Linq

1.       First-First element of sequence

2.       Skip-Remaining elements of sequence

3.       Reverse-Reverse the sequence

string[] array = new string[] {"aaaa","bbbb","cccc" };

                IEnumerable<string> result1 = array.Take(2);

                IEnumerable<string> result2 = array.Skip(2);

                IEnumerable<string> result3 = array.Reverse();

          

                foreach (string i in result1)

                                Console.WriteLine(i);

                foreach (string i in result2)

                                Console.WriteLine(i);

                foreach (string i in result3)

                                Console.WriteLine(i);

                Console.ReadLine();

Ebook Download
View all
Learn
View all