Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if an array exists in List of arrays

Tags:

arrays

c#

list

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?

like image 484
Saeed Areffard Avatar asked Oct 25 '25 19:10

Saeed Areffard


1 Answers

Use SequenceEqual:

bool result = Output.Any(a => a.SequenceEqual(coordinates));
like image 108
Ousmane D. Avatar answered Oct 27 '25 09:10

Ousmane D.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!