Created
December 7, 2013 10:33
-
-
Save ilivewithian/7839470 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static T FindParent<T>(this Control target) where T : Control | |
{ | |
if (target.Parent == null) | |
{ | |
return null; | |
} | |
var parent = target.Parent as T; | |
if (parent != null) | |
{ | |
return parent; | |
} | |
return target.Parent.FindParent<T>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment