Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用反射枚举具有MethodAttributes.PrivateScope的方法?_C#_.net_Reflection - Fatal编程技术网

C# 如何使用反射枚举具有MethodAttributes.PrivateScope的方法?

C# 如何使用反射枚举具有MethodAttributes.PrivateScope的方法?,c#,.net,reflection,C#,.net,Reflection,如何使用反射枚举具有MethodAttributes.PrivateScope的方法?您是否尝试过: Type t = typeof(MyClass); var Methods = t.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance); foreach (MethodInfo mInfo in Methods) { if (mInfo.Attributes == MethodAttributes.PrivateScop

如何使用反射枚举具有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.
    }
}