Created
December 19, 2016 18:49
-
-
Save ellenia/444c4291bdbbfb462c12672e0a3be210 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
namespace EnumParsing | |
{ | |
enum Status | |
{ | |
Unknown = 0, | |
Active = 1, | |
Inactive = 2 | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Status activeStatus = Status.Active; | |
int intStatus = (int)activeStatus; | |
Status inactiveStatus = (Status)2; | |
Status status = (Status)Enum.Parse(typeof(Status), "Active"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment