I\'ve a situation where I need to check whether multiple variables are having same data such as
var x=1;
var y=1;
var z=1;
I want to check
XOR might work for you, e.g. given:
var x=1;
var y=1;
var z=1;
Then
x ^ y ^ z == 0
Is true
-edit- If you want to check if all values are the same and their value is 1, use:
x ^ y ^ z ^ 1 == 0
Slight variation on the excellent answer given by jevakallio above. See if myValue is equal to any of the values in a list (in the array):
if (new[] { 10, 11, 12 }.Any(x => x == myValue))