@@ -97,8 +97,8 @@ public static bool TryParse(string range, out SlotRange value)
9797 /// <param name="other">The other slot range to compare to.</param>
9898 public int CompareTo ( SlotRange other )
9999 {
100- int delta = ( int ) this . from - ( int ) other . from ;
101- return delta == 0 ? ( int ) this . to - ( int ) other . to : delta ;
100+ int delta = ( int ) from - ( int ) other . from ;
101+ return delta == 0 ? ( int ) to - ( int ) other . to : delta ;
102102 }
103103
104104 /// <summary>
@@ -161,7 +161,7 @@ internal ClusterConfiguration(ServerSelectionStrategy serverSelectionStrategy, s
161161 {
162162 // Beware: Any exception thrown here will wreak silent havoc like inability to connect to cluster nodes or non returning calls
163163 this . serverSelectionStrategy = serverSelectionStrategy ;
164- this . Origin = origin ;
164+ Origin = origin ;
165165 using ( var reader = new StringReader ( nodes ) )
166166 {
167167 string line ;
@@ -178,7 +178,7 @@ internal ClusterConfiguration(ServerSelectionStrategy serverSelectionStrategy, s
178178 // make sure that things like clusterConfiguration[clusterConfiguration.Origin]
179179 // will work as expected.
180180 if ( node . IsMyself )
181- this . Origin = node . EndPoint ;
181+ Origin = node . EndPoint ;
182182
183183 if ( nodeLookup . ContainsKey ( node . EndPoint ) )
184184 {
@@ -286,7 +286,7 @@ internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint or
286286 {
287287 // https://redis.io/commands/cluster-nodes
288288 this . configuration = configuration ;
289- this . Raw = raw ;
289+ Raw = raw ;
290290 var parts = raw . Split ( StringSplits . Space ) ;
291291
292292 var flags = parts [ 2 ] . Split ( StringSplits . Comma ) ;
@@ -319,8 +319,7 @@ internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint or
319319 {
320320 if ( SlotRange . TryParse ( parts [ i ] , out SlotRange range ) )
321321 {
322- if ( slots == null ) slots = new List < SlotRange > ( parts . Length - i ) ;
323- slots . Add ( range ) ;
322+ ( slots ?? ( slots = new List < SlotRange > ( parts . Length - i ) ) ) . Add ( range ) ;
324323 }
325324 }
326325 Slots = slots ? . AsReadOnly ( ) ?? NoSlots ;
@@ -338,10 +337,9 @@ public IList<ClusterNode> Children
338337 List < ClusterNode > nodes = null ;
339338 foreach ( var node in configuration . Nodes )
340339 {
341- if ( node . ParentNodeId == this . NodeId )
340+ if ( node . ParentNodeId == NodeId )
342341 {
343- if ( nodes == null ) nodes = new List < ClusterNode > ( ) ;
344- nodes . Add ( node ) ;
342+ ( nodes ?? ( nodes = new List < ClusterNode > ( ) ) ) . Add ( node ) ;
345343 }
346344 }
347345 children = nodes ? . AsReadOnly ( ) ?? NoNodes ;
@@ -416,14 +414,14 @@ public int CompareTo(ClusterNode other)
416414 {
417415 if ( other == null ) return - 1 ;
418416
419- if ( this . IsSlave != other . IsSlave ) return IsSlave ? 1 : - 1 ; // masters first
417+ if ( IsSlave != other . IsSlave ) return IsSlave ? 1 : - 1 ; // masters first
420418
421419 if ( IsSlave ) // both slaves? compare by parent, so we get masters A, B, C and then slaves of A, B, C
422420 {
423- int i = string . CompareOrdinal ( this . ParentNodeId , other . ParentNodeId ) ;
421+ int i = string . CompareOrdinal ( ParentNodeId , other . ParentNodeId ) ;
424422 if ( i != 0 ) return i ;
425423 }
426- return string . CompareOrdinal ( this . NodeId , other . NodeId ) ;
424+ return string . CompareOrdinal ( NodeId , other . NodeId ) ;
427425 }
428426
429427 /// <summary>
0 commit comments