2010-05-20 64 views

回答

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

卫生署!我忘了BindingFlags – 2010-05-20 17:22:41

+0

@Jeff - 呵呵,很高兴帮助。 – 2010-05-20 17:33:03