Combine SequenceEqual Operator with Take, Concat and Skip in CSharp
Description
The following code shows how to combine SequenceEqual Operator with Take, Concat and Skip.
Example
using System;/*from w w w. j a v a2 s . c o m*/
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
public static void Main() {
string[] presidents = {"G", "H", "a", "H", "over", "Jack"};
bool eq = presidents.SequenceEqual(presidents.Take(5).Concat(presidents.Skip(5)));
Console.WriteLine(eq);
}
}
The code above generates the following result.