我想检查用户的输入是否是数字。如果是,我希望该功能继续运行,否则想提醒他并再次运行它。
Console.WriteLine(String.Concat("choose your action" ,Environment.NewLine ,
"1.Deposit", Environment.NewLine,
"2.Withdraw", Environment.NewLine,
"3.CheckAccount"));
string c = Console.ReadLine();
int value = Convert.ToInt32(c);
if (value==char.IsLetterOrDigit(value)) //<----- no good why?
{
switch (value)
{
case 1:
Deposit();
return;
case 2:
Withdraw();
return;
case 3:
CheckAccount();
return;
}
}