10public static class ImmutableSortedDictionary
 
   95        return source.ToImmutableSortedDictionary(keyComparer, 
null);
 
 
  100        return source.ToImmutableSortedDictionary(
null, 
null);
 
 
  103[DebuggerDisplay(
"Count = {Count}")]
 
  105public sealed class ImmutableSortedDictionary<TKey, TValue> : 
IImmutableDictionary<TKey, TValue>, 
IReadOnlyDictionary<TKey, TValue>, 
IEnumerable<KeyValuePair<TKey, TValue>>, 
IEnumerable, 
IReadOnlyCollection<KeyValuePair<TKey, TValue>>, 
ISortKeyCollection<TKey>, 
IDictionary<TKey, TValue>, 
ICollection<KeyValuePair<TKey, TValue>>, 
IDictionary, 
ICollection where TKey : 
notnull 
  107    [DebuggerDisplay(
"Count = {Count}")]
 
  109    public sealed class Builder : 
IDictionary<TKey, TValue>, 
ICollection<KeyValuePair<TKey, TValue>>, 
IEnumerable<KeyValuePair<TKey, TValue>>, 
IEnumerable, 
IReadOnlyDictionary<TKey, TValue>, 
IReadOnlyCollection<KeyValuePair<TKey, TValue>>, 
IDictionary, 
ICollection 
  156        public TValue 
this[TKey 
key]
 
 
  176        bool IDictionary.IsFixedSize => 
false;
 
  178        bool IDictionary.IsReadOnly => 
false;
 
  185        object ICollection.SyncRoot
 
 
  198        bool ICollection.IsSynchronized => 
false;
 
  254                return this[(TKey)
key];
 
 
 
  490                value.ClearFastWhenEmpty();
 
 
  521                stack.ClearFastWhenEmpty();
 
 
  546            while (!
node.IsEmpty)
 
 
 
  554    [DebuggerDisplay(
"{_key} = {_value}")]
 
  589        int IBinaryTree.Count
 
 
  675            Requires.NotNull(keyComparer, 
"keyComparer");
 
 
  684            Requires.NotNull(keyComparer, 
"keyComparer");
 
 
  692            Requires.NotNull(keyComparer, 
"keyComparer");
 
 
  699            Requires.NotNull(keyComparer, 
"keyComparer");
 
 
  711            Requires.NotNull(keyComparer, 
"keyComparer");
 
  715                value = 
default(TValue);
 
 
  725            Requires.NotNull(keyComparer, 
"keyComparer");
 
 
  739            Requires.NotNull(keyComparer, 
"keyComparer");
 
 
  762            Requires.NotNull(keyComparer, 
"keyComparer");
 
 
  785            if (
tree._right.IsEmpty)
 
 
  796            if (
tree._left.IsEmpty)
 
 
  807            if (
tree._right.IsEmpty)
 
 
  818            if (
tree._left.IsEmpty)
 
 
  829            return tree._right._height - 
tree._left._height;
 
 
  875            int num = (
length - 1) / 2;
 
 
  892            int num = keyComparer.Compare(
key, 
_key);
 
 
  939            int num = keyComparer.Compare(
key, 
_key);
 
  958                    while (!
node2._left.IsEmpty)
 
 
 1014            int num = keyComparer.Compare(
key, 
_key);
 
 
 
 1082    bool IDictionary.IsFixedSize => 
true;
 
 1084    bool IDictionary.IsReadOnly => 
true;
 
 1094            return this[(TKey)
key];
 
 
 1103    object ICollection.SyncRoot => 
this;
 
 1106    bool ICollection.IsSynchronized => 
true;
 
 1119        Requires.NotNull(keyComparer, 
"keyComparer");
 
 
 1210        if (keyComparer == 
null)
 
 
 
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
bool ICollection< KeyValuePair< TKey, TValue > >. IsReadOnly
Enumerator GetEnumerator()
void Add(TKey key, TValue value)
bool Contains(KeyValuePair< TKey, TValue > item)
TValue GetValueOrDefault(TKey key, TValue defaultValue)
bool Remove(KeyValuePair< TKey, TValue > item)
bool TryGetKey(TKey equalKey, out TKey actualKey)
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > items)
ICollection< TValue > IDictionary< TKey, TValue >. Values
Builder(ImmutableSortedDictionary< TKey, TValue > map)
bool ContainsValue(TValue value)
TValue? GetValueOrDefault(TKey key)
IComparer< TKey > _keyComparer
void RemoveRange(IEnumerable< TKey > keys)
ImmutableSortedDictionary< TKey, TValue >.Enumerator GetEnumerator()
bool ContainsKey(TKey key)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool IDictionary. Contains(object key)
IComparer< TKey > KeyComparer
ImmutableSortedDictionary< TKey, TValue > _immutable
IEqualityComparer< TValue > _valueComparer
IEqualityComparer< TValue > ValueComparer
ImmutableSortedDictionary< TKey, TValue > ToImmutable()
void Add(TKey key, TValue value)
ICollection< TKey > IDictionary< TKey, TValue >. Keys
void Add(KeyValuePair< TKey, TValue > item)
ref readonly TValue ValueRef(TKey key)
IDictionaryEnumerator IDictionary. GetEnumerator()
Enumerator GetEnumerator()
Node RemoveRecursive(TKey key, IComparer< TKey > keyComparer, out bool mutated)
static readonly Node EmptyNode
IBinaryTree< KeyValuePair< TKey, TValue > >? IBinaryTree< KeyValuePair< TKey, TValue > >. Left
static Node DoubleLeft(Node tree)
static Node RotateLeft(Node tree)
IEnumerable< TValue > Values
void CopyTo(KeyValuePair< TKey, TValue >[] array, int arrayIndex, int dictionarySize)
bool TryGetKey(TKey equalKey, IComparer< TKey > keyComparer, out TKey actualKey)
Node Search(TKey key, IComparer< TKey > keyComparer)
static bool IsRightHeavy(Node tree)
static Node RotateRight(Node tree)
bool Contains(KeyValuePair< TKey, TValue > pair, IComparer< TKey > keyComparer, IEqualityComparer< TValue > valueComparer)
bool ContainsValue(TValue value, IEqualityComparer< TValue > valueComparer)
Node SetItem(TKey key, TValue value, IComparer< TKey > keyComparer, IEqualityComparer< TValue > valueComparer, out bool replacedExistingValue, out bool mutated)
IBinaryTree< KeyValuePair< TKey, TValue > >? IBinaryTree< KeyValuePair< TKey, TValue > >. Right
Node(TKey key, TValue value, Node left, Node right, bool frozen=false)
static Node MakeBalanced(Node tree)
static bool IsLeftHeavy(Node tree)
Enumerator GetEnumerator(Builder builder)
static Node NodeTreeFromList(IOrderedCollection< KeyValuePair< TKey, TValue > > items, int start, int length)
static Node NodeTreeFromSortedDictionary(SortedDictionary< TKey, TValue > dictionary)
Node Remove(TKey key, IComparer< TKey > keyComparer, out bool mutated)
Node Mutate(Node left=null, Node right=null)
ref readonly TValue ValueRef(TKey key, IComparer< TKey > keyComparer)
static int Balance(Node tree)
static Node DoubleRight(Node tree)
Node SetOrAdd(TKey key, TValue value, IComparer< TKey > keyComparer, IEqualityComparer< TValue > valueComparer, bool overwriteExistingValue, out bool replacedExistingValue, out bool mutated)
Node Add(TKey key, TValue value, IComparer< TKey > keyComparer, IEqualityComparer< TValue > valueComparer, out bool mutated)
bool TryGetValue(TKey key, IComparer< TKey > keyComparer, [MaybeNullWhen(false)] out TValue value)
KeyValuePair< TKey, TValue > Value
void CopyTo(Array array, int arrayIndex, int dictionarySize)
bool ContainsKey(TKey key, IComparer< TKey > keyComparer)
bool TryGetKey(TKey equalKey, out TKey actualKey)
static ImmutableSortedDictionary< TKey, TValue >.Builder CreateBuilder< TKey, TValue >()
static ImmutableSortedDictionary< TKey, TValue > CreateRange< TKey, TValue >(IEnumerable< KeyValuePair< TKey, TValue > > items)
static ImmutableSortedDictionary< TKey, TValue > Create< TKey, TValue >()
ImmutableSortedDictionary< TKey, TValue > Remove(TKey value)
ImmutableSortedDictionary< TKey, TValue > AddRange(IEnumerable< KeyValuePair< TKey, TValue > > items)
ImmutableSortedDictionary(Node root, int count, IComparer< TKey > keyComparer, IEqualityComparer< TValue > valueComparer)
readonly IEqualityComparer< TValue > _valueComparer
IEnumerable< TValue > Values
static ImmutableSortedDictionary< TKey, TValue > ToImmutableSortedDictionary< TKey, TValue >(this ImmutableSortedDictionary< TKey, TValue >.Builder builder)
Enumerator GetEnumerator()
static ImmutableSortedDictionary< TKey, TValue > Wrap(Node root, int count, IComparer< TKey > keyComparer, IEqualityComparer< TValue > valueComparer)
ImmutableSortedDictionary(IComparer< TKey >? keyComparer=null, IEqualityComparer< TValue >? valueComparer=null)
ImmutableSortedDictionary< TKey, TValue > Add(TKey key, TValue value)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
ImmutableSortedDictionary< TKey, TValue > WithComparers(IComparer< TKey >? keyComparer)
IDictionaryEnumerator IDictionary. GetEnumerator()
ImmutableSortedDictionary< TKey, TValue > AddRange(IEnumerable< KeyValuePair< TKey, TValue > > items, bool overwriteOnCollision, bool avoidToSortedMap)
IEqualityComparer< TValue > ValueComparer
ImmutableSortedDictionary< TKey, TValue > SetItems(IEnumerable< KeyValuePair< TKey, TValue > > items)
ImmutableSortedDictionary< TKey, TValue > WithComparers(IComparer< TKey >? keyComparer, IEqualityComparer< TValue >? valueComparer)
static ImmutableSortedDictionary< TKey, TValue > ToImmutableSortedDictionary< TSource, TKey, TValue >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector, Func< TSource, TValue > elementSelector, IComparer< TKey >? keyComparer, IEqualityComparer< TValue >? valueComparer)
readonly IComparer< TKey > _keyComparer
bool ContainsValue(TValue value)
IComparer< TKey > KeyComparer
static bool TryCastToImmutableMap(IEnumerable< KeyValuePair< TKey, TValue > > sequence, [NotNullWhen(true)] out ImmutableSortedDictionary< TKey, TValue > other)
ImmutableSortedDictionary< TKey, TValue > SetItem(TKey key, TValue value)
ref readonly TValue ValueRef(TKey key)
bool Contains(KeyValuePair< TKey, TValue > pair)
bool ContainsKey(TKey key)
ImmutableSortedDictionary< TKey, TValue > FillFromEmpty(IEnumerable< KeyValuePair< TKey, TValue > > items, bool overwriteOnCollision)
ImmutableSortedDictionary< TKey, TValue > RemoveRange(IEnumerable< TKey > keys)
ImmutableSortedDictionary< TKey, TValue > Wrap(Node root, int adjustedCountIfDifferentRoot)
ImmutableSortedDictionary< TKey, TValue > Clear()
static void Range(bool condition, string? parameterName, string? message=null)
static byte Max(byte val1, byte val2)
static string Format(string resourceFormat, object p1)
static string CollectionModifiedDuringEnumeration
static string DuplicateKey
static string Arg_KeyNotFoundWithKey
static int CompareExchange(ref int location1, int value, int comparand)
void CopyTo(Array array, int index)
new IDictionaryEnumerator GetEnumerator()
void Add(object key, object? value)
bool Contains(object key)
IEnumerator GetEnumerator()
new bool Equals(object? x, object? y)
Enumerator(Node root, Builder? builder=null)
KeyValuePair< TKey, TValue > Current
readonly Builder _builder
static readonly SecureObjectPool< Stack< RefAsValueType< Node > >, Enumerator > s_enumeratingStacks
int _enumeratingBuilderVersion
SecurePooledObject< Stack< RefAsValueType< Node > > > _stack
object IEnumerator. Current