Created
June 22, 2021 16:37
-
-
Save pfrozi/edaf8429e1d7c6524c82c453853dee2d to your computer and use it in GitHub Desktop.
Flags example
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
using System; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var e = Teste.Cliente | Teste.Documentos; | |
Console.WriteLine(e.HasFlag(Teste.Cliente)); | |
Console.WriteLine(e.HasFlag(Teste.Liberacoes)); | |
Console.WriteLine(e.HasFlag(Teste.Documentos)); | |
} | |
[Flags] | |
public enum Teste | |
{ | |
Cliente = 1 << 0, | |
Liberacoes = 1 << 1, | |
Documentos = 1 << 2, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment