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

◆ Add() [8/8]

static MutationResult System.Collections.Immutable.ImmutableDictionary< TKey, TValue >.Add ( TKey key,
TValue value,
KeyCollisionBehavior behavior,
MutationInput origin )
inlinestaticprivate

Definition at line 1427 of file ImmutableDictionary.cs.

1428 {
1429 Requires.NotNullAllowStructs(key, "key");
1430 int hashCode = origin.KeyComparer.GetHashCode(key);
1431 OperationResult result;
1432 HashBucket newBucket = origin.Root.GetValueOrDefault(hashCode).Add(key, value, origin.KeyOnlyComparer, origin.ValueComparer, behavior, out result);
1433 if (result == OperationResult.NoChangeRequired)
1434 {
1435 return new MutationResult(origin);
1436 }
1437 SortedInt32KeyNode<HashBucket> root = UpdateRoot(origin.Root, hashCode, newBucket, origin.HashBucketComparer);
1438 return new MutationResult(root, (result == OperationResult.SizeChanged) ? 1 : 0);
1439 }
void Add(TKey key, TValue value)
static SortedInt32KeyNode< HashBucket > UpdateRoot(SortedInt32KeyNode< HashBucket > root, int hashCode, HashBucket newBucket, IEqualityComparer< HashBucket > hashBucketComparer)

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.IEqualityComparer.GetHashCode(), System.Collections.Immutable.ImmutableDictionary< TKey, TValue >.MutationInput.HashBucketComparer, System.key, System.Collections.Immutable.ImmutableDictionary< TKey, TValue >.MutationInput.KeyComparer, System.Collections.Immutable.ImmutableDictionary< TKey, TValue >.MutationInput.KeyOnlyComparer, System.Collections.Immutable.ImmutableDictionary< TKey, TValue >.MutationInput.Root, System.Collections.Immutable.ImmutableDictionary< TKey, TValue >.UpdateRoot(), System.value, and System.Collections.Immutable.ImmutableDictionary< TKey, TValue >.MutationInput.ValueComparer.