For instance. I have the following enum
[Flags]
public enum Stuff
{
stuff1=1,
stuff2=2,
stuff3=4,
stuff4=8
}
So I set mystuff to
mystuff = Stuff.stuff1|Stuff.stuff2;
then I set hisstuff to
hisstuff = Stuff.stuff2|Stuff.stuff3;
How do I now test if these overlap -ie hisstuff and mystuff both contain at least one of the same enum values?
And also if there are multiple ways to do it which is the most efficient? (This is for a game)
Simple:
This does a bitwise “and”, then tests for any intersection.