Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ReadOnlyDictionary.cs
Go to the documentation of this file.
5
7
10[DebuggerDisplay("Count = {Count}")]
11[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
12public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary, ICollection, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>> where TKey : notnull
13{
15 {
17
19
21
22 public object Key => _enumerator.Current.Key;
23
24 public object Value => _enumerator.Current.Value;
25
26 public object Current => Entry;
27
33
34 public bool MoveNext()
35 {
36 return _enumerator.MoveNext();
37 }
38
39 public void Reset()
40 {
42 }
43 }
44
46 [DebuggerDisplay("Count = {Count}")]
48 {
50
51 public int Count => _collection.Count;
52
54
56
58 {
59 get
60 {
62 {
63 return this;
64 }
65 return collection.SyncRoot;
66 }
67 }
68
70 {
71 _collection = collection ?? throw new ArgumentNullException("collection");
72 }
73
78
83
85 {
87 }
88
89 public void CopyTo(TKey[] array, int arrayIndex)
90 {
92 }
93
98
100 {
101 return _collection.GetEnumerator();
102 }
103
105 {
106 return ((IEnumerable)_collection).GetEnumerator();
107 }
108
113 }
114
116 [DebuggerDisplay("Count = {Count}")]
117 public sealed class ValueCollection : ICollection<TValue>, IEnumerable<TValue>, IEnumerable, ICollection, IReadOnlyCollection<TValue>
118 {
120
121 public int Count => _collection.Count;
122
124
126
128 {
129 get
130 {
132 {
133 return this;
134 }
135 return collection.SyncRoot;
136 }
137 }
138
140 {
141 _collection = collection ?? throw new ArgumentNullException("collection");
142 }
143
148
153
155 {
156 return _collection.Contains(item);
157 }
158
159 public void CopyTo(TValue[] array, int arrayIndex)
160 {
162 }
163
168
170 {
171 return _collection.GetEnumerator();
172 }
173
175 {
176 return ((IEnumerable)_collection).GetEnumerator();
177 }
178
183 }
184
186
189
192
194
196
198
200
202
203 public TValue this[TKey key] => m_dictionary[key];
204
206 {
207 get
208 {
209 return m_dictionary[key];
210 }
211 set
212 {
214 }
215 }
216
217 public int Count => m_dictionary.Count;
218
220
222
224
226
228
229 object? IDictionary.this[object key]
230 {
231 get
232 {
233 if (!IsCompatibleKey(key))
234 {
235 return null;
236 }
237 if (m_dictionary.TryGetValue((TKey)key, out var value))
238 {
239 return value;
240 }
241 return null;
242 }
243 set
244 {
246 }
247 }
248
250
252 {
253 get
254 {
256 {
257 return this;
258 }
259 return collection.SyncRoot;
260 }
261 }
262
264
266
271
272 public bool ContainsKey(TKey key)
273 {
274 return m_dictionary.ContainsKey(key);
275 }
276
277 public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
278 {
279 return m_dictionary.TryGetValue(key, out value);
280 }
281
286
291
296
301
306
311
316
321
323 {
324 return ((IEnumerable)m_dictionary).GetEnumerator();
325 }
326
327 private static bool IsCompatibleKey(object key)
328 {
329 if (key == null)
330 {
331 throw new ArgumentNullException("key");
332 }
333 return key is TKey;
334 }
335
336 void IDictionary.Add(object key, object value)
337 {
339 }
340
345
347 {
348 if (IsCompatibleKey(key))
349 {
350 return ContainsKey((TKey)key);
351 }
352 return false;
353 }
354
363
368
370 {
373 {
374 m_dictionary.CopyTo(array2, index);
375 return;
376 }
378 {
379 {
381 {
382 array3[index++] = new DictionaryEntry(item.Key, item.Value);
383 }
384 return;
385 }
386 }
387 if (!(array is object[] array4))
388 {
390 }
391 try
392 {
394 {
396 }
397 }
399 {
401 }
402 }
403}
static void ValidateCopyToArguments(int sourceCount, Array array, int index)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. IsReadOnly
void Add(TKey key, TValue value)
ReadOnlyDictionary(IDictionary< TKey, TValue > dictionary)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
ICollection< TValue > IDictionary< TKey, TValue >. Values
IEnumerator< KeyValuePair< TKey, TValue > > GetEnumerator()
IEnumerable< TValue > IReadOnlyDictionary< TKey, TValue >. Values
readonly IDictionary< TKey, TValue > m_dictionary
IEnumerable< TKey > IReadOnlyDictionary< TKey, TValue >. Keys
ICollection< TKey > IDictionary< TKey, TValue >. Keys
static string NotSupported_ReadOnlyCollection
Definition SR.cs:28
static string Argument_InvalidArrayType
Definition SR.cs:54
Definition SR.cs:7
void CopyTo(T[] array, int arrayIndex)
void CopyTo(Array array, int index)
new IDictionaryEnumerator GetEnumerator()
void Add(object key, object? value)
readonly IEnumerator< KeyValuePair< TKey, TValue > > _enumerator