0
如何使用反射来枚举具有MethodAttributes.PrivateScope的方法?如何使用反射来枚举具有MethodAttributes.PrivateScope的方法?
如何使用反射来枚举具有MethodAttributes.PrivateScope的方法?如何使用反射来枚举具有MethodAttributes.PrivateScope的方法?
您是否尝试过:
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.
}
}
卫生署!我忘了BindingFlags – 2010-05-20 17:22:41
@Jeff - 呵呵,很高兴帮助。 – 2010-05-20 17:33:03