How can I enumerate methods that have MethodAttributes.PrivateScope using Reflection?
views:
12answers:
1
+1
A:
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.
}
}
Kyle Rozendo
2010-05-20 16:58:17
Doh! I forgot BindingFlags
Jeffrey LeCours
2010-05-20 17:22:41
@Jeff - Hehe, glad to help.
Kyle Rozendo
2010-05-20 17:33:03