How to check if an item is equal to any item in an array?

arrays, c#

Solution

Just use the `Contains` LINQ method. You'll need to add `using System.Linq` to access the method.

if(array.Contains(5))
{
    //TODO do stuff
}

Problem

For instance, if I had an `int[5] array = {1, 2, 3, 4, 5}` and an `int check = 5` Is there an easy way to check `if (check == any item in array)` then do something?

Original source