如何使用Reflection枚举具有MethodAttributes.PrivateScope的方法?

时间:2010-05-20 16:53:52

标签: c# .net reflection

如何使用Reflection枚举具有MethodAttributes.PrivateScope的方法?

1 个答案:

答案 0 :(得分:1)

你试过了吗?

Type t = typeof(MyClass);
var Methods = t.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance);

foreach (MethodInfo mInfo in Methods)
{
    if (mInfo.Attributes == MethodAttributes.PrivateScope))
    {
        // Do what needs to be done.
    }
}