It's quite simple:
public static Type MakeRef(Type type)
{
return type.Assembly.GetType(type.FullName + "&");
}
Regards,
Jeroen
> -----Original Message-----
> From: Jason Whittington [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 07:13
> To: [EMAIL PROTECTED]
> Subject: [ADVANCED-DOTNET] Binding to a method that takes a "ref"
>
>
> If I have this function:
>
> void f(int x);
>
> then binding to it is easy:
>
> MethodInfo m = typeof(MyClass).GetMethod("f", new Type
> {typeof(Int32)});
>
>
> However if I change it to this:
>
> void f(ref int x);
>
> I can't very well say:
>
> MethodInfo m = typeof(MyClass).GetMethod("f", new Type
> {typeof(Int32&)});
>
> So far all the only way I see to do this is to loop over each function
> matching the name "f" and then see if it has a single
> parameter and then
> getting parameterInfo for it and testing to see if it has
> TypeIsRef set
> and does not have IsOut set.
>
> Given a Type T, can you get a Type object representing type T& ?
>
>
> Jason
>