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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -