I would like to find a way to check if a set of values is contained in my variable.
[Flags]
public enum Combinations
{
Type1CategoryA = 0x01,
Type1CategoryB = 0x02,
Type1CategoryC = 0x04,
Type2CategoryA = 0x08,
Type2CategoryB = 0x10,
Type2CategoryC = 0x20,
Type3 = 0x40
}
bool CheckForCategoryB(byte combinations)
{
if (combinations in [Combinations.Type1CategoryB, Combinations.Type2CategoryB])
return true;
return false;
}
I am transplanting to .NET from Delphi. This is pretty simple code to write to Delphi, but I'm not sure how to do it in C #.
source
share