You don’t have a method called StringfromMonths
in your code and this, apart from the compiler error, seems really misleading because I suppose that this lost method returns a string, instead you are trying to print the numeric value of the enum Months.September
…
If you really want to print the numeric value of a enum value, you need to convert to an integer.
So it is simply:
Console.WriteLine("You have selected September which has the value {0}",
Convert.ToInt32(Months.September));
By the way, as written above, the Month of September has value = 0, October = 1, November=11, December = 12. (And all of your switch cases prints September?)
Last but not least, what is “Octobar”? A bar where you order 1 and get 8? I will go there every Saturday night. :-))))
1
solved Error due to Stringfrom method [closed]