Hi all,
I am doing a small console program in C# where I am asking the user to input his name, and telephone number.
Now, I wish to make the program to recognize if the phone number is all in integer form and the name in character form.
Note that the data type is of string for both the name and the phone number.
I did some research and found that TryParse can be used to check for integer input, but how can I ask the user to rewrite the name?
Below is my current code:
Console.Write("Enter Name: ");
name = Console.ReadLine();
Console.Write("Phone number: ");
phone = Console.ReadLine();
Any help would be highly appreciated and sorry for my poor English.
I am doing a small console program in C# where I am asking the user to input his name, and telephone number.
Now, I wish to make the program to recognize if the phone number is all in integer form and the name in character form.
Note that the data type is of string for both the name and the phone number.
I did some research and found that TryParse can be used to check for integer input, but how can I ask the user to rewrite the name?
Below is my current code:
Console.Write("Enter Name: ");
name = Console.ReadLine();
Console.Write("Phone number: ");
phone = Console.ReadLine();
Any help would be highly appreciated and sorry for my poor English.