Geeks With Blogs
Benjamin Howarth, Code Gecko January 2009 Entries
How many ways can you tell if a variable is a number in C#?
Lots, according to the comments on this post! I finally settled on: if (int.TryParse(isNewList, out isNewList) != false) {} It conspires that TryParse has a try...catch block built into it, and returns false if it can't convert from a string to a number (i.e. if it's NaN). CodeGecko ......

Posted On Tuesday, January 13, 2009 11:46 AM

Copyright © TheInspiredGecko | Powered by: GeeksWithBlogs.net