Monday 13 November 2017

c# - How to select next enum value ?





I've a C# enum type:




private enum DayName {
Monday=1, Tuesday=2 ... Sunday=7 };

private DayName today
;

today =
DayName.Friday;


How to
do something like:




today ++
;
print(today) ->



and get "Saturday" ?


style="font-weight: bold;">

Answer




Well first set today =
DayName.Friday
and then print(today.ToString()
after the today ++ ;



As
descirbed at this SO post, href="https://stackoverflow.com/questions/309333/enum-string-name-from-value">Enum
String Name from Value


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...