VB(6) has isnumeric and isdate functions.
VB.net and c#.net are both more precise in their nature.
Each relevant data type has a TryParse method:
in c#
int iResult;
string sTest;
int.TryParse(sTest, out iResult)
and similarly for date, guid, single, double etc
This is a definite improvement on VB6 as the conversion process can be implimented in one line and the conversion criteria are more precise. Also a default value can be ascribed if the parse function fails. My only argument is trying to find this fuctionality when searching for terms like inumeric, cast and convert.
http://msdn.microsoft.com/en-us/library/f02979c7.aspx
- int32
http://msdn.microsoft.com/en-us/library/9h21f14e.aspx
- date
http://msdn.microsoft.com/en-us/library/system.guid.tryparse.aspx
- guid
http://msdn.microsoft.com/en-us/library/system.single.tryparse.aspx
-single
etc
|
© 2009 Added Value Applications
|