Red Gate forums :: View topic - Cast not valid issue
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
.NET Reflector 7 EAP
.NET Reflector 7 EAP forum

Cast not valid issue

Search in .NET Reflector 7 EAP forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
alehandro



Joined: 16 Nov 2010
Posts: 35

PostPosted: Sat Jan 29, 2011 12:00 pm    Post subject: Cast not valid issue Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. 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