compare arrays c# code example
Example: c# compare a variable with an array
bool exists = false;
int checkNum;
int[] myNums = new int[10]
for (int i = 0; i < myNums.Length; i++){
if (checkNum == myNums[i]){
exists = true;
}
}
if (exists){
Console.WriteLine("Your number {0} is in the Array.");
}else{
Console.WriteLine("Your number {0} does not match any number in the Array.");
}