views:

12

answers:

1

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

+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
Doh! I forgot BindingFlags
Jeffrey LeCours
@Jeff - Hehe, glad to help.
Kyle Rozendo