I want to check if user's input is a number. If yes I want the function to keep running else want to alert him and run it again.
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;
}
}
String.Concatmate! There's an operator for that, namely the string concatenation operator+, which is optimized into a call toString.Concat.