开发者

How can I enumerate methods that have MethodAttributes.PrivateScope using Reflection?

How can I enumerate methods 开发者_StackOverflow中文版that have MethodAttributes.PrivateScope using Reflection?


Have you tried:

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.
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜