I am looking for a way to cast an int to an Enum, e.g.
var result = (MyEnum)value;
The Problem is that i only have the Integer and a System.Type.
And this doesn't work:
var result = (type)value;
Thanks for your help.
I am looking for a way to cast an int to an Enum, e.g.
var result = (MyEnum)value;
The Problem is that i only have the Integer and a System.Type.
And this doesn't work:
var result = (type)value;
Thanks for your help.
You can use:
Enum.ToObject(type, value);
Although I have no idea how you expect to use that result if you don't know what the type is at compile time.