How would I convert a int to enum value at runtime when I have a string and an integer? [duplicate]
问题 This question already has answers here : Create instance of unknown Enum with string value using reflection in C# (2 answers) Closed 24 days ago . What I have is a string variable that is the name of a enum. I have the integer of the enum. How would I convert that into instance of the enum itself? Enum TestEnum { One = 1, Two = 2, Three = 3 } string str = "TestEnum"; int intValue = 2; I see many posts that require you to have an instance of the enum to get it's like this highly upvoted answer