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]);
alehandro
0

Add comment

Please sign in to leave a comment.