Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Hashtable() [4/17]

System.Collections.Hashtable.Hashtable ( int capacity,
float loadFactor )
inline

Definition at line 554 of file Hashtable.cs.

555 {
556 if (capacity < 0)
557 {
558 throw new ArgumentOutOfRangeException("capacity", SR.ArgumentOutOfRange_NeedNonNegNum);
559 }
560 if (!(loadFactor >= 0.1f) || !(loadFactor <= 1f))
561 {
562 throw new ArgumentOutOfRangeException("loadFactor", SR.Format(SR.ArgumentOutOfRange_HashtableLoadFactor, 0.1, 1.0));
563 }
564 _loadFactor = 0.72f * loadFactor;
565 double num = (float)capacity / _loadFactor;
566 if (num > 2147483647.0)
567 {
568 throw new ArgumentException(SR.Arg_HTCapacityOverflow, "capacity");
569 }
570 int num2 = ((num > 3.0) ? HashHelpers.GetPrime((int)num) : 3);
571 _buckets = new bucket[num2];
572 _loadsize = (int)(_loadFactor * (float)num2);
573 _isWriterInProgress = false;
574 }
volatile bool _isWriterInProgress
Definition Hashtable.cs:407

References System.Collections.Hashtable._buckets, System.Collections.Hashtable._isWriterInProgress, System.Collections.Hashtable._loadFactor, System.Collections.Hashtable._loadsize, System.SR.Arg_HTCapacityOverflow, System.SR.ArgumentOutOfRange_HashtableLoadFactor, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.capacity, System.Runtime.Serialization.Dictionary, System.SR.Format(), and System.Collections.HashHelpers.GetPrime().