Created
July 23, 2016 23:20
-
-
Save Fhernd/45656f8e5048f5ddbc5f46a4e8d0ba25 to your computer and use it in GitHub Desktop.
Demostración conversión explícita de valor enumeración a entero, y viceversa. [OrtizOL]
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
void Main() | |
{ | |
// Cast explícito enumeración a entero: | |
int i = (int) Lados.Izquierdo; | |
// Cast explícito entero a enumeración: | |
Lados izquierdo = (Lados) i; | |
} | |
// Enumeración personalizada: | |
[Flags] | |
public enum Lados | |
{ | |
Izquierdo = 1, | |
Derecho = 2, | |
Superior = 3, | |
Inferior = 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment