开发者

Is it possible to infer that a ParameterInfo object refers to a function pointer containing managed parameter types?

I'm using reflection to examine the following method declaration and am wondering if it is poss开发者_如何转开发ible 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜