@@ -296,11 +296,13 @@ protected virtual void CompareProperties(Node source, Node target, NodeDifferenc
296296 continue ;
297297
298298 if ( any . Nesting . PropertyInfo != null && accessor . DependencyRootType == any . Nesting . PropertyInfo . PropertyType ) {
299- if ( propertyDifference is NodeDifference )
300- ( ( NodeDifference ) propertyDifference ) . IsDependentOnParent = true ;
301- else if ( propertyDifference is NodeCollectionDifference )
302- ( ( NodeCollectionDifference ) propertyDifference ) . ItemChanges
299+ if ( propertyDifference is NodeDifference nodeDifference ) {
300+ nodeDifference . IsDependentOnParent = true ;
301+ }
302+ else if ( propertyDifference is NodeCollectionDifference nodeCollectionDifference ) {
303+ nodeCollectionDifference . ItemChanges
303304 . ForEach ( item=> item . IsDependentOnParent = true ) ;
305+ }
304306 }
305307 difference . PropertyChanges . Add ( property . Name , propertyDifference ) ;
306308 }
@@ -411,12 +413,12 @@ protected virtual Difference VisitNodeCollection(NodeCollection source, NodeColl
411413 return difference . ItemChanges . Count != 0 ? difference : null ;
412414 }
413415 }
414-
416+
415417 // Sort by items only with source, then by (target ?? source).Index then with source and target and then only with target
416418 private static int CompareNodeDifference ( NodeDifference curr , NodeDifference other )
417419 {
418- var currType = curr . Source != null && curr . Target != null ? 1 : curr . Source == null ? 3 : 0 ;
419- var otherType = other . Source != null && other . Target != null ? 1 : other . Source == null ? 3 : 0 ;
420+ var currType = curr . Source != null && curr . Target != null ? 1 : curr . Source == null ? 3 : 0 ;
421+ var otherType = other . Source != null && other . Target != null ? 1 : other . Source == null ? 3 : 0 ;
420422 var typeIsNot0Comparison = ( currType != 0 ) . CompareTo ( otherType != 0 ) ;
421423 if ( typeIsNot0Comparison != 0 ) {
422424 return typeIsNot0Comparison ;
@@ -590,10 +592,10 @@ protected virtual bool IsImmutable(Node node)
590592 /// <returns>Comparison key for the specified node.</returns>
591593 protected virtual string GetNodeComparisonKey ( Node node )
592594 {
593- if ( ! ( node is INodeReference ) )
595+ if ( ! ( node is INodeReference nodeReference ) )
594596 return GetTargetName ( node ) ;
595597
596- var targetNode = ( ( INodeReference ) node ) . Value ;
598+ var targetNode = nodeReference . Value ;
597599 return targetNode == null ? null : GetTargetPath ( targetNode ) ;
598600 }
599601
0 commit comments