次のプログラムをコンパイルすると、エラーが発生します。バグはStringfromMonthsにあります。現在のコンテキストには存在しないことを示しています。enume Monthsから定数の文字列を取得し、同時にそれを文字列に変換したいので、現在のコンテストにはどのように存在しませんか。
レスポンシブに感謝します!
using System;
enum Months
{
September,
Octobar,
November = 11,
December,
}
class Montest
{
public static void Main()
{
string s;
Console.WriteLine("Please choose a month");
Console.WriteLine("September");
Console.WriteLine("Octobar");
Console.WriteLine("November");
Console.WriteLine("December");
s = Console.ReadLine();
switch (s)
{
case "September":
Console.WriteLine("You have selected September which has the Valuve {0}",StringfromMonths(Months.September));
break;
case "October":
Console.WriteLine("You have selected September which has the Valuve {0}", StringfromMonths(Months.September));
break;
case "November":
Console.WriteLine("You have selected September which has the Valuve {0}", StringfromMonths(Months.September));
break;
case "December":
Console.WriteLine("You have selected September which has the Valuve {0}", StringfromMonths(Months.September));
break;
}
}
}