开发者

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

开发者 https://www.devze.com 2022-12-30 20:30 出处:网络
How can I enumerate methods 开发者_StackOverflow中文版that have MethodAttributes.PrivateScope using Reflection?Have you tried:

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

精彩评论

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