I want to define a method which returns true or false if a subset of an enum (first argument) contains an enum element (second element)
In other words, having an enum like:
public enum type { INST, INST_NAME, OPEN_BR, CLOSED_BR};
I wish to define a method like this one:
public bool check (IEnumerable <type> subset , type t)
{if(subset.Contains t)
return true;
else
return false;
}
And then call it with:
check(new List<type>{INST, INST_NAME},type.INST);
Which returns true since the list contains INST. So the question is: do you know any more elegant way to implement this method (assuming that it works).
Thank you for your answers!