◆ MemoryList() [1/3]
48 : this(address, count, count, true)
49 {
50 }
◆ MemoryList() [2/3]
52 : this(address, count, count, readOnly)
53 {
54 }
◆ MemoryList() [3/3]
57 {
58 _count = count;
59 _cap = capacity;
60 _readOnly = readOnly;
61 _stride = Marshal.SizeOf(typeof(T));
62 _base = (byte*) address;
63 }
◆ Add()
141 {
142 if (_readOnly || _count >= _cap)
143 {
144 throw new AccessViolationException();
145 }
146
147 Marshal.StructureToPtr(item, (IntPtr) (_base + _count * _stride), false);
148 _count++;
149 }
◆ Clear()
152 {
153 _count = 0;
154 }
◆ Contains()
157 {
159 }
int IndexOf(T item)
Definition: MemoryList.cs:65
◆ CopyTo()
162 {
163 if (arrayIndex + _count > array.Length)
164 {
165 throw new ArgumentException();
166 }
167
168 int index = arrayIndex;
169 foreach (T t in this)
170 {
171 array[index++] = t;
172 }
173 }
◆ GetEnumerator()
197 {
198 return new MemoryEnumerator<T>(_base, _count);
199 }
◆ IndexOf()
66 {
67 byte* p = _base;
68 for (int i = 0; i < _count; i++, p += _stride)
69 {
70 if (item.Equals(Marshal.PtrToStructure((IntPtr) p, typeof(T))))
71 {
72 return i;
73 }
74 }
75
76 return -1;
77 }
◆ Insert()
80 {
81 if (_readOnly || _count >= _cap)
82 {
83 throw new AccessViolationException();
84 }
85
86 if (index >= _count || index < 0)
87 {
88 throw new IndexOutOfRangeException();
89 }
90
91 byte* p = _base + index * _stride;
92 Memory.Move(p + _stride, p, (uint) ((_count - index) * _stride));
93 _count++;
94 }
◆ Remove()
180 {
181 if (_readOnly)
182 {
183 throw new AccessViolationException();
184 }
185
187 if (index >= 0)
188 {
190 return true;
191 }
192
193 return false;
194 }
void RemoveAt(int index)
Definition: MemoryList.cs:96
◆ RemoveAt()
97 {
98 if (_readOnly)
99 {
100 throw new AccessViolationException();
101 }
102
103 if (index >= _count || index < 0)
104 {
105 throw new IndexOutOfRangeException();
106 }
107
108 byte* p = _base + index * _stride;
109 Memory.Move(p, p + _stride, (uint) ((_count - 1 - index) * _stride));
110 _count--;
111 }
◆ Capacity
◆ Count
◆ IsReadOnly
◆ this[int index]
114 {
115 get
116 {
117 if (index >= _count || index < 0)
118 {
119 throw new IndexOutOfRangeException();
120 }
121
122 return (T) Marshal.PtrToStructure((IntPtr) (_base + index * _stride), typeof(T));
123 }
124 set
125 {
126 if (_readOnly)
127 {
128 throw new AccessViolationException();
129 }
130
131 if (index >= _count || index < 0)
132 {
133 throw new IndexOutOfRangeException();
134 }
135
136 Marshal.StructureToPtr(value, (IntPtr) (_base + index * _stride), false);
137 }
138 }
The documentation for this class was generated from the following file:
- BrawlLib/Internal/MemoryList.cs