Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ActivityTagsCollection.cs
Go to the documentation of this file.
3
4namespace System.Diagnostics;
5
6public class ActivityTagsCollection : IDictionary<string, object?>, ICollection<KeyValuePair<string, object?>>, IEnumerable<KeyValuePair<string, object?>>, IEnumerable
7{
8 public struct Enumerator : IEnumerator<KeyValuePair<string, object?>>, IEnumerator, IDisposable
9 {
11
13
14 object IEnumerator.Current => ((IEnumerator)_enumerator).Current;
15
20
21 public void Dispose()
22 {
23 _enumerator.Dispose();
24 }
25
26 public bool MoveNext()
27 {
28 return _enumerator.MoveNext();
29 }
30
32 {
33 ((IEnumerator)_enumerator).Reset();
34 }
35 }
36
38
39 public object? this[string key]
40 {
41 get
42 {
43 int num = FindIndex(key);
44 if (num >= 0)
45 {
46 return _list[num].Value;
47 }
48 return null;
49 }
50 set
51 {
52 if (key == null)
53 {
54 throw new ArgumentNullException("key");
55 }
56 int num = FindIndex(key);
57 if (value == null)
58 {
59 if (num >= 0)
60 {
61 _list.RemoveAt(num);
62 }
63 }
64 else if (num >= 0)
65 {
67 }
68 else
69 {
71 }
72 }
73 }
74
76 {
77 get
78 {
81 {
82 list.Add(item.Key);
83 }
84 return list;
85 }
86 }
87
89 {
90 get
91 {
94 {
95 list.Add(item.Value);
96 }
97 return list;
98 }
99 }
100
101 public bool IsReadOnly => false;
102
103 public int Count => _list.Count;
104
106 {
107 }
108
110 {
111 if (list == null)
112 {
113 throw new ArgumentNullException("list");
114 }
116 {
117 if (item.Key != null)
118 {
119 this[item.Key] = item.Value;
120 }
121 }
122 }
123
124 public void Add(string key, object? value)
125 {
126 if (key == null)
127 {
128 throw new ArgumentNullException("key");
129 }
130 int num = FindIndex(key);
131 if (num >= 0)
132 {
134 }
136 }
137
139 {
140 if (item.Key == null)
141 {
142 throw new ArgumentNullException("item");
143 }
144 int num = FindIndex(item.Key);
145 if (num >= 0)
146 {
148 }
149 _list.Add(item);
150 }
151
152 public void Clear()
153 {
154 _list.Clear();
155 }
156
158 {
159 return _list.Contains(item);
160 }
161
162 public bool ContainsKey(string key)
163 {
164 return FindIndex(key) >= 0;
165 }
166
171
176
178 {
179 return new Enumerator(_list);
180 }
181
183 {
184 return new Enumerator(_list);
185 }
186
187 public bool Remove(string key)
188 {
189 if (key == null)
190 {
191 throw new ArgumentNullException("key");
192 }
193 int num = FindIndex(key);
194 if (num >= 0)
195 {
196 _list.RemoveAt(num);
197 return true;
198 }
199 return false;
200 }
201
203 {
204 return _list.Remove(item);
205 }
206
207 public bool TryGetValue(string key, out object? value)
208 {
209 int num = FindIndex(key);
210 if (num >= 0)
211 {
212 value = _list[num].Value;
213 return true;
214 }
215 value = null;
216 return false;
217 }
218
219 private int FindIndex(string key)
220 {
221 for (int i = 0; i < _list.Count; i++)
222 {
223 if (_list[i].Key == key)
224 {
225 return i;
226 }
227 }
228 return -1;
229 }
230}
void CopyTo(T[] array)
Definition List.cs:364
void RemoveAt(int index)
Definition List.cs:824
ActivityTagsCollection(IEnumerable< KeyValuePair< string, object?> > list)
bool TryGetValue(string key, out object? value)
void CopyTo(KeyValuePair< string, object?>[] array, int arrayIndex)
List< KeyValuePair< string, object > > _list
bool Contains(KeyValuePair< string, object?> item)
bool Remove(KeyValuePair< string, object?> item)
void Add(KeyValuePair< string, object?> item)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string KeyAlreadyExist
Definition SR.cs:36
Definition SR.cs:7
new IEnumerator< T > GetEnumerator()
List< KeyValuePair< string, object > >.Enumerator _enumerator
Enumerator(List< KeyValuePair< string, object > > list)