fork download
  1. using System;
  2.  
  3. [Flags]
  4. internal enum Bordes
  5. {
  6. Izquierdo = 1,
  7. Derecho = 2,
  8. Superior = 4,
  9. Inferior = 8,
  10. Todos = Derecho | Superior | Inferior | Izquierdo
  11. }
  12.  
  13. public class Test
  14. {
  15. public static void Main()
  16. {
  17. for (int i = 0; i <= 16; ++i)
  18. {
  19. Bordes borde = (Bordes) i;
  20.  
  21. Console.WriteLine( "¿El valor `{0}` está definido?: {1}", i, ValorBanderaDefinido(borde));
  22. }
  23. }
  24.  
  25. static bool ValorBanderaDefinido(Bordes e)
  26. {
  27. return !(Bordes.Todos & e) != 0;
  28. }
  29. }
Compilation error #stdin compilation error #stdout 0.03s 33928KB
stdin
Standard input is empty
compilation info
prog.cs(27,24): error CS0023: The `!' operator cannot be applied to operand of type `Bordes'
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty