c# - How to extract the values of all of the constants in an enum - into a char array? -
it's possible extract values in enum
char[]
?
i have enum
:
enum etypelanguage { typed = 't', functional = 'f' }
how extract values etypelanguage
char
array?
seems looking (it returns string[]
):
enum.getnames(typeof(etypelanguage)); //returns: typed, functional
if looking values ('t', 'f') may (this won't throw system.invalidcastexception
enum):
var values = enum.getvalues(typeof(etypelanguage)) .cast<etypelanguage>() .select(i => (char)i).toarray(); //returns: 't', 'f'
Comments
Post a Comment