mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-28 08:47:59 +01:00
Fix IsOverridden method per @tig in https://github.com/gui-cs/Terminal.Gui/issues/2156#issuecomment-1299338732
This commit is contained in:
@@ -3083,12 +3083,17 @@ namespace Terminal.Gui {
|
||||
/// <param name="view">The view.</param>
|
||||
/// <param name="method">The method name.</param>
|
||||
/// <returns><see langword="true"/> if it's overridden, <see langword="false"/> otherwise.</returns>
|
||||
public bool IsOverridden (View view, string method)
|
||||
public static bool IsOverridden (View view, string method)
|
||||
{
|
||||
Type t = view.GetType ();
|
||||
MethodInfo m = t.GetMethod (method);
|
||||
|
||||
return (m.DeclaringType == t || m.ReflectedType == t) && m.GetBaseDefinition ().DeclaringType == typeof (Responder);
|
||||
MethodInfo m = view.GetType ().GetMethod (method,
|
||||
BindingFlags.Instance
|
||||
| BindingFlags.Public
|
||||
| BindingFlags.NonPublic
|
||||
| BindingFlags.DeclaredOnly);
|
||||
if (m == null) {
|
||||
return false;
|
||||
}
|
||||
return m.GetBaseDefinition ().DeclaringType != m.DeclaringType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user