diff --git a/WIndows.Forms/Extensions/ControlExtension.cs b/WIndows.Forms/Extensions/ControlExtension.cs index a75c0453..3afe8057 100644 --- a/WIndows.Forms/Extensions/ControlExtension.cs +++ b/WIndows.Forms/Extensions/ControlExtension.cs @@ -48,7 +48,7 @@ namespace Vanara.Extensions /// The based of the parent control to retrieve. /// This control. /// The parent control matching T or null if not found. - public static T GetParent(this Control ctrl) where T : Control, new() + public static T GetParent(this Control ctrl) where T : class { var p = ctrl.Parent; while (p != null & !(p is T)) @@ -60,7 +60,7 @@ namespace Vanara.Extensions /// The based of the parent control to retrieve. /// This control. /// The top-most parent control matching T or null if not found. - public static T GetTopMostParent(this Control ctrl) where T : Control, new() + public static T GetTopMostParent(this Control ctrl) where T : class { var stack = new System.Collections.Generic.Stack(); var p = ctrl.Parent;