Skip to content

Instantly share code, notes, and snippets.

@pfrozi
Created June 22, 2021 16:37
Show Gist options
  • Save pfrozi/edaf8429e1d7c6524c82c453853dee2d to your computer and use it in GitHub Desktop.
Save pfrozi/edaf8429e1d7c6524c82c453853dee2d to your computer and use it in GitHub Desktop.
Flags example
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