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

◆ CopyTo()

void System.Collections.ListDictionaryInternal.CopyTo ( Array array,
int index )
inline

Implements System.Collections.ICollection.

Definition at line 354 of file ListDictionaryInternal.cs.

355 {
356 if (array == null)
357 {
358 throw new ArgumentNullException("array");
359 }
360 if (array.Rank != 1)
361 {
362 throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
363 }
364 if (index < 0)
365 {
366 throw new ArgumentOutOfRangeException("index", SR.ArgumentOutOfRange_NeedNonNegNum);
367 }
368 if (array.Length - index < Count)
369 {
370 throw new ArgumentException(SR.ArgumentOutOfRange_Index, "index");
371 }
372 for (DictionaryNode next = head; next != null; next = next.next)
373 {
374 array.SetValue(new DictionaryEntry(next.key, next.value), index);
375 index++;
376 }
377 }

References System.SR.Arg_RankMultiDimNotSupported, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.array, System.Collections.ListDictionaryInternal.Count, System.Collections.ListDictionaryInternal.head, System.index, and System.Collections.ListDictionaryInternal.DictionaryNode.next.