static void ShowAllMethods(Type t, ShowMethodType showMethodType) { MemberInfo[] infos = null; switch (showMethodType) { case ShowMethodType.OnlyPublic: infos = t.GetMethods(BindingFlags.Public); break; case ShowMethodType.NoPublic: infos = t.GetMethods(BindingFlags.NonPublic); break; case ShowMethodType.PublicStatic: infos = t.GetMethods(BindingFlags.Public & BindingFlags.Static); break; case ShowMethodType.PublicNoStatic: infos = t.GetMethods(BindingFlags.Public & BindingFlags.Instance); break; default: infos = t.GetMethods(); break; } foreach (MemberInfo info in infos) { MyLog.Blue(info.Name); } }
public static void ShowAllMethods(string typeString, ShowMethodType showMethodType) { ShowAllMethods(GetType(typeString), showMethodType); }
public static void ShowAllMethods(object obj, ShowMethodType showMethodType) { ShowAllMethods(obj.GetType(), showMethodType); }
public static void ShowAllMethods <T>( //Log出这个Class的所有方法 ShowMethodType showMethodType) { ShowAllMethods(typeof(T), showMethodType); }