3 public struct Enumerator : IEnumerator<KeyValuePair<TKey, TValue>> {
27 throw new InvalidOperationException(
"SortedMultiCollection was modified, enumeration cannot continue.");
40 throw new InvalidOperationException(
"SortedMultiCollection was modified, enumeration cannot continue.");
49 public KeyValuePair<TKey, TValue>[]
m_array;
62 value = Math.Max(Math.Max(4,
m_count), value);
64 KeyValuePair<TKey, TValue>[] array =
new KeyValuePair<TKey, TValue>[value];
71 public KeyValuePair<TKey, TValue>
this[
int i] {
76 throw new ArgumentOutOfRangeException();
81 m_array =
new KeyValuePair<TKey, TValue>[4];
86 m_array =
new KeyValuePair<TKey, TValue>[4];
91 capacity = Math.Max(capacity, 4);
92 m_array =
new KeyValuePair<TKey, TValue>[capacity];
97 capacity = Math.Max(capacity, 4);
98 m_array =
new KeyValuePair<TKey, TValue>[capacity];
102 public void Add(TKey key, TValue value) {
109 m_array[num] =
new KeyValuePair<TKey, TValue>(key, value);
114 public void AddRange(IEnumerable<KeyValuePair<TKey, TValue>> items) {
115 foreach (KeyValuePair<TKey, TValue> item
in items) {
116 Add(item.Key, item.Value);
133 for (
int i = 0; i <
m_count; i++) {
154 IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator() =>
new Enumerator(
this);
156 IEnumerator IEnumerable.GetEnumerator() =>
new Enumerator(
this);
170 while (num <= num2) {
171 int num3 = (num + num2) >> 1;
184 if (lastFound != -1) {
KeyValuePair< TKey, TValue >[] m_array
SortedMultiCollection(IComparer< TKey > comparer)
void EnsureCapacity(int capacity)
IComparer< TKey > m_comparer
SortedMultiCollection(int capacity, IComparer< TKey > comparer)
Enumerator GetEnumerator()
bool ContainsKey(TKey key)
SortedMultiCollection< TKey, TValue > m_collection
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > items)
SortedMultiCollection(int capacity)
Enumerator(SortedMultiCollection< TKey, TValue > collection)
KeyValuePair< TKey, TValue > Current
KeyValuePair< TKey, TValue > m_current
void Add(TKey key, TValue value)
bool TryGetValue(TKey key, out TValue value)