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

◆ TryAdd()

bool System.Xml.Linq.XHashtable< TValue >.XHashtableState.TryAdd ( TValue value,
out TValue newValue )
inline

Definition at line 95 of file XHashtable.cs.

96 {
98 string text = _extractKey(value);
99 if (text == null)
100 {
101 return true;
102 }
103 int num = ComputeHashCode(text, 0, text.Length);
105 if (num2 < 0 || num2 >= _buckets.Length)
106 {
107 return false;
108 }
110 _entries[num2].HashCode = num;
112 int entryIndex = 0;
113 while (!FindEntry(num, text, 0, text.Length, ref entryIndex))
114 {
116 if (entryIndex <= 0)
117 {
118 return entryIndex == 0;
119 }
120 }
122 return true;
123 }
static int CompareExchange(ref int location1, int value, int comparand)
static int Increment(ref int location)
static void MemoryBarrier()
Definition Thread.cs:827
readonly ExtractKeyDelegate _extractKey
Definition XHashtable.cs:27
static int ComputeHashCode(string key, int index, int count)
bool FindEntry(int hashCode, string key, int index, int count, ref int entryIndex)

References System.Xml.Linq.XHashtable< TValue >.XHashtableState._buckets, System.Xml.Linq.XHashtable< TValue >.XHashtableState._entries, System.Xml.Linq.XHashtable< TValue >.XHashtableState._extractKey, System.Xml.Linq.XHashtable< TValue >.XHashtableState._numEntries, System.Threading.Interlocked.CompareExchange(), System.Xml.Linq.XHashtable< TValue >.XHashtableState.ComputeHashCode(), System.Xml.Dictionary, System.Xml.Linq.XHashtable< TValue >.XHashtableState.FindEntry(), System.Xml.Linq.XHashtable< TValue >.XHashtableState.Entry.HashCode, System.Threading.Interlocked.Increment(), System.Threading.Thread.MemoryBarrier(), System.Xml.Linq.XHashtable< TValue >.XHashtableState.Entry.Next, System.text, System.value, and System.Xml.Linq.XHashtable< TValue >.XHashtableState.Entry.Value.

Referenced by System.Xml.Linq.XHashtable< TValue >.Add().