-1

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" ?

stighy
  • 7,260
  • 25
  • 97
  • 157
  • 1
    Did you *try* today++? – Anthony Pegram Apr 21 '16 at 21:35
  • @AnthonyPegram I don't think if this question is a duplication. The OP doesn't know about DateTime.AddDays. I will do something like this => You can use the following code: `Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.GetDayName(DateTime.Today.AddDays(1).DayOfWeek));` – CodeNotFound Apr 21 '16 at 21:43
  • @CodeNotFound, you're limiting yourself to the specific details, though the question is broadly applicable, and even the question title is broad. (Not to mention that the user has defined his own custom enum type that deviates from DayOfWeek [by starting at 1, with Sunday at the end, not the beginning].) After solving this problem, the user may very well need to solve another enum problem having nothing to do with dates. – Anthony Pegram Apr 21 '16 at 21:51

1 Answers1

0

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

As descirbed at this SO post, Enum String Name from Value

Community
  • 1
  • 1
SGM1
  • 968
  • 2
  • 12
  • 23