Created
September 6, 2015 10:57
-
-
Save angelovstanton/3b2a51e7c526347623ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var minionsNames = (Minions.Bob | Minions.Dave).ToString(); | |
// Displays 'Bob, Dave' | |
Console.WriteLine(minionsNames); | |
var allowedMinionsToParticipate = Minions.Dave | Minions.Kevin | Minions.Stuart; | |
// To retrieve the distinct values in you property one can do this | |
Console.WriteLine(allowedMinionsToParticipate); | |
if ((allowedMinionsToParticipate & Minions.Dave) == Minions.Dave) | |
{ | |
Console.WriteLine("Dave is allowed to be a party animal!"); | |
} | |
// In .NET 4 and later | |
if (allowedMinionsToParticipate.HasFlag(Minions.Bob)) | |
{ | |
Console.WriteLine("Bob is allowed to be a party animal!"); | |
} | |
else | |
{ | |
Console.WriteLine("No more tequila for Bob. :("); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment