Skip to content

Commit

Permalink
! Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed Sep 17, 2022
1 parent bf03ff2 commit 50af945
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Codist/Helpers/WpfHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,8 @@ public static TParent GetParent<TParent>(this DependencyObject obj, Predicate<TP
return null;
}
var p = obj;
TParent r;
while ((p = p.GetParent()) != null) {
r = p as TParent;
if (r != null && (predicate == null || predicate(r))) {
if (p is TParent r && (predicate == null || predicate(r))) {
return r;
}
}
Expand Down

0 comments on commit 50af945

Please sign in to comment.