Quantcast
Channel: cyotek.com Blog Summary Feed
Viewing all articles
Browse latest Browse all 559

Using alternate descriptions for enumeration members

$
0
0
Enums are useful language features. But what happens when you want to display a string version of an enum member rather than just casting the member to a string? You could manually create a switch statement for conversion, and periodically update such functions when extending the source enum. Or you could use the power of reflection and attributes to do it automatically.

Viewing all articles
Browse latest Browse all 559

Trending Articles