| Author |
Message |
alehandro
Joined: 16 Nov 2010 Posts: 35
|
Posted: Sat Jan 29, 2011 12:00 pm Post subject: Cast not valid issue |
|
|
Hi, in some cases a cast is required for uint (maybe some other basic types)
in following example
objArray2 = p3 as object[];
string str = objArray2[0] as string;
string str2 = objArray2[1] as string;
DateTime time = (DateTime) objArray2[2];
uint num2 = (uint) objArray2[3];
the last line throws an exception:
---------------------------
Exception
---------------------------
Specified cast is not valid.
at ...........[skipped]
---------------------------
OK
---------------------------
not sure whats the right was to handle it.....
I've changed last line into
uint num2 = Convert.ToUInt32(objArray2[3]); |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group