You mean a bit flag, as in the power of two?
Like this:
Func<int, int> pow2 = null; pow2 = n => n == 0 ? 1 : 2 * pow2(n - 1); int myFlag = myVar.Reverse().Select((a, n) => a.IsSelected ? pow2(n) : 0).Sum();
Or simply means this:
int myFlag = myVar.Where(a => a.IsSelected).Any();
source share