C#C
C#4y ago
Raki

✅ How to check whether a given list is present in the List of list

I have a List<List<int>> candidates and before adding into it want to check whether a list is already present. The condition is true all the time. How to implement the check condition for each addition

var temp = new List<int>(tempList);
if(!candidates.Any(x => x == temp))
{
candidates.Add(temp);
}
Was this page helpful?