views:

56

answers:

1

I'm using reflection to examine the following method declaration and am wondering if it is possible to determine that the method's sole parameter is a function pointer.

public ref class T
{
public:
    void foo(Int32 (*)(String^, array<TimeSpan>^)) { }
};

When inspecting the ParameterInfo object for foo's parameter, it shows that the parameter's type is IntPtr; this makes sense since a function pointer is not a native CLR type.

Since the function pointer contains only managed parameter types, I was hoping to get some extra context in the ParameterInfo. I don't see any properties or attributes in ParameterInfo and Type that may help me distinguish this IntPtr instance as a function pointer -- are there any?

A: 

After some thought, I'm very sure this is not possible. Since the function argument to foo is a native pointer, the managed reflection system can't see beyond that layer and will always present the argument as IntPtr.

Steve Guidi