Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SZArrayHelper.cs
Go to the documentation of this file.
3
4namespace System;
5
6internal sealed class SZArrayHelper
7{
8 private SZArrayHelper()
9 {
10 }
11
13 {
14 T[] array = Unsafe.As<T[]>(this);
15 if (array.Length != 0)
16 {
18 }
19 return SZGenericArrayEnumerator<T>.Empty;
20 }
21
22 private void CopyTo<T>(T[] array, int index)
23 {
24 T[] array2 = Unsafe.As<T[]>(this);
25 Array.Copy(array2, 0, array, index, array2.Length);
26 }
27
28 internal int get_Count<T>()
29 {
30 T[] array = Unsafe.As<T[]>(this);
31 return array.Length;
32 }
33
34 internal T get_Item<T>(int index)
35 {
36 T[] array = Unsafe.As<T[]>(this);
37 if ((uint)index >= (uint)array.Length)
38 {
40 }
41 return array[index];
42 }
43
44 internal void set_Item<T>(int index, T value)
45 {
46 T[] array = Unsafe.As<T[]>(this);
47 if ((uint)index >= (uint)array.Length)
48 {
50 }
51 array[index] = value;
52 }
53
54 private void Add<T>(T value)
55 {
56 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
57 }
58
59 private bool Contains<T>(T value)
60 {
61 T[] array = Unsafe.As<T[]>(this);
62 return Array.IndexOf(array, value, 0, array.Length) >= 0;
63 }
64
65 private bool get_IsReadOnly<T>()
66 {
67 return true;
68 }
69
70 private void Clear<T>()
71 {
72 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
73 }
74
75 private int IndexOf<T>(T value)
76 {
77 T[] array = Unsafe.As<T[]>(this);
78 return Array.IndexOf(array, value, 0, array.Length);
79 }
80
81 private void Insert<T>(int index, T value)
82 {
83 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
84 }
85
86 private bool Remove<T>(T value)
87 {
88 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
89 return false;
90 }
91
92 private void RemoveAt<T>(int index)
93 {
94 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
95 }
96}
int IList. IndexOf(object value)
Definition Array.cs:1228
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
void set_Item< T >(int index, T value)
T get_Item< T >(int index)
bool Remove< T >(T value)
bool Contains< T >(T value)
int IndexOf< T >(T value)
void RemoveAt< T >(int index)
void Add< T >(T value)
void Insert< T >(int index, T value)
IEnumerator< T > GetEnumerator< T >()
void CopyTo< T >(T[] array, int index)
static void ThrowNotSupportedException(ExceptionResource resource)
static void ThrowArgumentOutOfRange_IndexException()