chr
2026-04-05 fe750b791d5b517cc4e9bc8e99a9a75139a0cfba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
 
namespace OpenTap
{
    class EmptyDictionary<K, V> : IDictionary<K, V>
    {
        private EmptyDictionary() { }
        public static EmptyDictionary<K, V> Instance { get; } = new EmptyDictionary<K, V>();
        public IEnumerator<KeyValuePair<K, V>> GetEnumerator() => Enumerable.Empty<KeyValuePair<K,V>>().GetEnumerator();
        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
        public void Add(KeyValuePair<K, V> item) => throw new NotSupportedException();
        public void Clear() { }
        public bool Contains(KeyValuePair<K, V> item) => false;
        public void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex) { }
        public bool Remove(KeyValuePair<K, V> item) => false;
        public int Count => 0;
        public bool IsReadOnly => true;
        public void Add(K key, V value) => throw new NotSupportedException();
        public bool ContainsKey(K key) => false;
        public bool Remove(K key) => false;
        public bool TryGetValue(K key, out V value)
        {
            value = default;
            return false;
        }
        public V this[K key]
        {
            get => throw new KeyNotFoundException();
            set => throw new NotSupportedException();
        }
        public ICollection<K> Keys => Array.Empty<K>();
        public ICollection<V> Values => Array.Empty<V>();
    }
}