Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Set()

IAsyncLocalValueMap System.Threading.AsyncLocalValueMap.MultiElementAsyncLocalValueMap.Set ( IAsyncLocal key,
object value,
bool treatNullValueAsNonexistent )
inline

Implements System.Threading.IAsyncLocalValueMap.

Definition at line 224 of file AsyncLocalValueMap.cs.

225 {
226 for (int i = 0; i < _keyValues.Length; i++)
227 {
228 if (key == _keyValues[i].Key)
229 {
230 if (value != null || !treatNullValueAsNonexistent)
231 {
236 }
237 if (_keyValues.Length == 4)
238 {
239 return i switch
240 {
241 2 => new ThreeElementAsyncLocalValueMap(_keyValues[0].Key, _keyValues[0].Value, _keyValues[1].Key, _keyValues[1].Value, _keyValues[3].Key, _keyValues[3].Value),
242 1 => new ThreeElementAsyncLocalValueMap(_keyValues[0].Key, _keyValues[0].Value, _keyValues[2].Key, _keyValues[2].Value, _keyValues[3].Key, _keyValues[3].Value),
243 0 => new ThreeElementAsyncLocalValueMap(_keyValues[1].Key, _keyValues[1].Value, _keyValues[2].Key, _keyValues[2].Value, _keyValues[3].Key, _keyValues[3].Value),
244 _ => new ThreeElementAsyncLocalValueMap(_keyValues[0].Key, _keyValues[0].Value, _keyValues[1].Key, _keyValues[1].Value, _keyValues[2].Key, _keyValues[2].Value),
245 };
246 }
248 if (i != 0)
249 {
251 }
252 if (i != _keyValues.Length - 1)
253 {
254 Array.Copy(_keyValues, i + 1, multiElementAsyncLocalValueMap2._keyValues, i, _keyValues.Length - i - 1);
255 }
257 }
258 }
259 if (value == null && treatNullValueAsNonexistent)
260 {
261 return this;
262 }
263 if (_keyValues.Length < 16)
264 {
269 }
270 ManyElementAsyncLocalValueMap manyElementAsyncLocalValueMap = new ManyElementAsyncLocalValueMap(17);
272 for (int j = 0; j < keyValues.Length; j++)
273 {
276 }
279 }
readonly KeyValuePair< IAsyncLocal, object >[] _keyValues

References System.Threading.AsyncLocalValueMap.MultiElementAsyncLocalValueMap.MultiElementAsyncLocalValueMap(), System.Threading.AsyncLocalValueMap.MultiElementAsyncLocalValueMap._keyValues, System.Array.Copy(), System.key, and System.value.