This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
src/mscorlib/shared/System/Collections/Generic Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -376,10 +376,15 @@ private int FindEntry(TKey key)
376376 private void Initialize ( int capacity )
377377 {
378378 int size = HashHelpers . GetPrime ( capacity ) ;
379- _buckets = new int [ size ] ;
380- for ( int i = 0 ; i < _buckets . Length ; i ++ ) _buckets [ i ] = - 1 ;
381- _entries = new Entry [ size ] ;
379+ int [ ] buckets = new int [ size ] ;
380+ for ( int i = 0 ; i < buckets . Length ; i ++ )
381+ {
382+ buckets [ i ] = - 1 ;
383+ }
384+
382385 _freeList = - 1 ;
386+ _buckets = buckets ;
387+ _entries = new Entry [ size ] ;
383388 }
384389
385390 private bool TryInsert ( TKey key , TValue value , InsertionBehavior behavior )
@@ -470,10 +475,7 @@ public virtual void OnDeserialization(object sender)
470475
471476 if ( hashsize != 0 )
472477 {
473- _buckets = new int [ hashsize ] ;
474- for ( int i = 0 ; i < _buckets . Length ; i ++ ) _buckets [ i ] = - 1 ;
475- _entries = new Entry [ hashsize ] ;
476- _freeList = - 1 ;
478+ Initialize ( hashsize ) ;
477479
478480 KeyValuePair < TKey , TValue > [ ] array = ( KeyValuePair < TKey , TValue > [ ] )
479481 siInfo . GetValue ( KeyValuePairsName , typeof ( KeyValuePair < TKey , TValue > [ ] ) ) ;
You can’t perform that action at this time.
0 commit comments