Casting returned object
From: Stuart Miles (spamtrap_at_moleshome.co.uk)
Date: 03/03/05
- Next message: Nick Malik [Microsoft]: "Re: searching for the highest index within a directory"
- Previous message: Peter Rilling: "Re: Writing to a configuration file"
- Next in thread: James: "Re: Casting returned object"
- Reply: James: "Re: Casting returned object"
- Reply: Wayne: "Re: Casting returned object"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 3 Mar 2005 15:32:46 +0000
I have a 3rd party DLL with a function that has a return parameter of type
object.
After I make the call:
messagingClass.eGetUnreadMessages(ref myId, ref msgs);
when I look at it in the Locals window I get the following:
- msgs {System.Array} System.Object
[0,0] "AFPSDEV1" string
[0,1] "AFPSDEV1" string
[0,2] "AFPSDEV1" string
+ [1,0] {12002} System.Int32
+ [1,1] {12003} System.Int32
+ [1,2] {12004} System.Int32
This looks like an array of eMsgIdentType so I try and cast it to that
eMsgIdentType[] unreadMsgs = (eMsgIdentType[])msgs;
But I get the following error:
An unhandled exception of type 'System.InvalidCastException' occurred in
Serialization.exe
Additional information: Specified cast is not valid.
As a complete newbie to C# can somebody point me in the right direction.
- Next message: Nick Malik [Microsoft]: "Re: searching for the highest index within a directory"
- Previous message: Peter Rilling: "Re: Writing to a configuration file"
- Next in thread: James: "Re: Casting returned object"
- Reply: James: "Re: Casting returned object"
- Reply: Wayne: "Re: Casting returned object"
- Messages sorted by: [ date ] [ thread ]