Saeed Areffard
Saeed Areffard

Reputation: 179

How to check if an array exists in List of arrays

I have a List of Arrays ... And I want to check if an exact array is in List or not

  List<int[]> Output = new List<int[]>();

I have an Array

int[] coordinates 

I want to check if coordinates array is exactly in List or Not?

Upvotes: 4

Views: 239

Answers (1)

Ousmane D.
Ousmane D.

Reputation: 56413

Use SequenceEqual:

bool result = Output.Any(a => a.SequenceEqual(coordinates));

Upvotes: 7

Related Questions