How to check whether two lists have the same exact elements in C#

1 Answer

0 votes
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main() {
        List<string> list1 = new List<string>() { "A", "B", "C", "D", "E" };
        List<string> list2 = new List<string>() { "A", "B", "C", "D", "e" };
        
        bool isEqual = list1.SequenceEqual(list2);
        
        Console.WriteLine(isEqual);
    }
}
 
 
 
 
/*
run:
 
False
 
*/

 



answered Mar 9, 2023 by avibootz

Related questions

1 answer 144 views
1 answer 127 views
1 answer 179 views
1 answer 97 views
...