问题描述
我的应用程序的一部分,我有一个接收的MethodInfo功能,需要做具体的操作它取决于如果该方法是扩展方法。
As part of my application I have a function that receives a MethodInfo and need to do specific operations on it depending if that method is "Extension Method".
我已检查的MethodInfo类,我找不到任何的 IsExtension 的,显示了该方法的扩展属性或标志。
I've checked the MethodInfo class and I could not find any IsExtension property or flag that shows that the method is extension.
有谁知道我怎么能找到从方法的MethodInfo的?
Does anyone knows how can I find that from the method's MethodInfo?
推荐答案
根据
http://stackoverflow.com/questions/702256/f-extensions-in-c
似乎还有编译的窗体上的属性。所以,看是否该方法具有这个属性:
it seems there is an attribute on the compiled form. So see if the method has this attribute:
http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.extensionattribute.aspx
这篇关于使用反射来检查的方法是:QUOT;扩展方法"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!