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?

4

1 回答 1

0

经过一番思考,我很确定这是不可能的。由于函数参数 tofoo本机指针,托管反射系统无法看到该层之外的内容,并且始终将参数显示为IntPtr.

于 2010-09-07T19:45:01.533 回答