lefodnes
asked on
Checking if int contained inside an array of ints in c#
Hi
I use this code to check if an int is inside an array of an int:
How can I do this in one line, without specifying the array variable, just something like:
I use this code to check if an int is inside an array of an int:
int[] aI = { 6, 12, 20, 21 };
ph.Visible = aI.Contains(20)
How can I do this in one line, without specifying the array variable, just something like:
ph.Visible = (int[] {6, 12, 20, 21}).Contains(20);
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks, both!