私がやりたいことは、私のプログラムを使用している人々が何も入力せずにEnterキーを押しても、エラーが発生しないことです。ここはプログラムの一部です:
Console.WriteLine("4.-Ya no quiero jugar >.<");
int opc = Convert.ToInt16(Console.ReadLine());
switch (opc)
{
case 1:
Console.WriteLine("omg");
break;
case 2:
Console.WriteLine("wtf");
break;
default:
Console.WriteLine("Cant do that >.>");
Console.ReadKey();
break;
etc.
}
事は整数を使用しています、私はこれをやろうとしました
string opc1=console.readline();
if (opc =="")
{
console.writeline("nope,try again");
}
else
{ // Brace was omitted in original - Jon
int opc = Convert.ToInt16(Console.ReadLine());
switch (opc)
blah blah.
およびそれのさまざまな組み合わせ >.< そしてデフォルトはそのためには機能しません
誰かが私がそれを解決するのを手伝ってくれることを願っています >.<