Why aren't you using the instance of the enumerated type instead of the
underlying system type?

Ted Neward
{.NET || Java} Course Author & Instructor, DevelopMentor
(http://www.develop.com)
http://www.javageeks.com/tneward
http://www.clrgeeks.com/tneward

----- Original Message -----
From: "John Dumais" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 3:51 PM
Subject: [DOTNET] invoke method with enum argument using underlying type?


> Hello,
>
> I'm probably not going about this the right way, but thought I'd ask
> anyway...
>
> I'm trying to use MethodInfo.Invoke() to call a method that takes an
> enumerated type as an argument.  In building the argument array for this
> method, I used the underlying system type, something like...
>
> int anArg = 85;
> object[] oa = new object[1];
> oa[0] = anArg;
> object oRet = mi.Invoke(instance, anArg);
>
> When I run this, Invoke throws an exception saying that it can't convert
> the argument into the target type.
>
> I'm kind of confused, given that the underlying system type, in this case,
> is of type System.Int32.  Can you just not use Invoke this way?
>
> Thanks,
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to