Skip to content

Commit 50af945

Browse files
committed
! Code refactoring
1 parent bf03ff2 commit 50af945

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Codist/Helpers/WpfHelper.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,8 @@ public static TParent GetParent<TParent>(this DependencyObject obj, Predicate<TP
332332
return null;
333333
}
334334
var p = obj;
335-
TParent r;
336335
while ((p = p.GetParent()) != null) {
337-
r = p as TParent;
338-
if (r != null && (predicate == null || predicate(r))) {
336+
if (p is TParent r && (predicate == null || predicate(r))) {
339337
return r;
340338
}
341339
}

0 commit comments

Comments
 (0)