|
-
November 9th, 2011, 09:32 AM
#6
Re: .net v3.5 readline errors when user submits null or string
Thanks a lot for the response guys, I ended up finding my answer in TryParse:
here's the before code:
Console.WriteLine("Please choose a character Race: \n1)Human \n2)Elf \n3)Orc");
race = int.Parse(Console.ReadLine());
after code:
Console.WriteLine("Please choose a character Race: \n1)Human \n2)Elf \n3)Orc");
int.TryParse(Console.ReadLine(), out race);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|