Linq Example 45 -SequenceEqual

11:51 PM
Linq Query:

//EqualAll
            string[] str1 = { "a", "b", "c" };
            string[] str2 = { "a", "b", "c" };

            bool IsEqual = str1.SequenceEqual(str2);
            Console.WriteLine(IsEqual);

            string[] str3 = { "a", "b", "c" };
            string[] str4 = { "b", "c", "a" };

            bool IsEqual1 = str3.SequenceEqual(str4);
            Console.WriteLine(IsEqual1);

//


Output:

True
False

Explanation:


Both the arrays must be equal in sequence.

0 comments:

Post a Comment