Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ArrayList.cs
Go to the documentation of this file.
3
4namespace System.Collections;
5
7[DebuggerTypeProxy(typeof(ArrayListDebugView))]
8[DebuggerDisplay("Count = {Count}")]
9[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
11{
12 private sealed class IListWrapper : ArrayList
13 {
15 {
17
18 private int _remaining;
19
20 private int _initialStartIndex;
21
22 private int _initialCount;
23
24 private bool _firstCall;
25
26 public object Current
27 {
28 get
29 {
30 if (_firstCall)
31 {
33 }
34 if (_remaining < 0)
35 {
37 }
38 return _en.Current;
39 }
40 }
41
42 internal IListWrapperEnumWrapper(IListWrapper listWrapper, int startIndex, int count)
43 {
44 _en = listWrapper.GetEnumerator();
47 while (startIndex-- > 0 && _en.MoveNext())
48 {
49 }
51 _firstCall = true;
52 }
53
55 {
56 }
57
58 public object Clone()
59 {
60 IListWrapperEnumWrapper listWrapperEnumWrapper = new IListWrapperEnumWrapper();
61 listWrapperEnumWrapper._en = (IEnumerator)((ICloneable)_en).Clone();
62 listWrapperEnumWrapper._initialStartIndex = _initialStartIndex;
63 listWrapperEnumWrapper._initialCount = _initialCount;
64 listWrapperEnumWrapper._remaining = _remaining;
65 listWrapperEnumWrapper._firstCall = _firstCall;
66 return listWrapperEnumWrapper;
67 }
68
69 public bool MoveNext()
70 {
71 if (_firstCall)
72 {
73 _firstCall = false;
74 if (_remaining-- > 0)
75 {
76 return _en.MoveNext();
77 }
78 return false;
79 }
80 if (_remaining < 0)
81 {
82 return false;
83 }
84 if (_en.MoveNext())
85 {
86 return _remaining-- > 0;
87 }
88 return false;
89 }
90
91 public void Reset()
92 {
93 _en.Reset();
94 int initialStartIndex = _initialStartIndex;
95 while (initialStartIndex-- > 0 && _en.MoveNext())
96 {
97 }
99 _firstCall = true;
100 }
101 }
102
103 private readonly IList _list;
104
105 public override int Capacity
106 {
107 get
108 {
109 return _list.Count;
110 }
111 set
112 {
113 if (value < Count)
114 {
116 }
117 }
118 }
119
120 public override int Count => _list.Count;
121
122 public override bool IsReadOnly => _list.IsReadOnly;
123
124 public override bool IsFixedSize => _list.IsFixedSize;
125
126 public override bool IsSynchronized => _list.IsSynchronized;
127
128 public override object this[int index]
129 {
130 get
131 {
132 return _list[index];
133 }
134 set
135 {
136 _list[index] = value;
137 _version++;
138 }
139 }
140
141 public override object SyncRoot => _list.SyncRoot;
142
144 {
145 _list = list;
146 _version = 0;
147 }
148
149 public override int Add(object obj)
150 {
151 int result = _list.Add(obj);
152 _version++;
153 return result;
154 }
155
156 public override void AddRange(ICollection c)
157 {
158 InsertRange(Count, c);
159 }
160
161 public override int BinarySearch(int index, int count, object value, IComparer comparer)
162 {
163 if (index < 0 || count < 0)
164 {
165 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
166 }
167 if (Count - index < count)
168 {
170 }
171 if (comparer == null)
172 {
174 }
175 int num = index;
176 int num2 = index + count - 1;
177 while (num <= num2)
178 {
179 int num3 = (num + num2) / 2;
180 int num4 = comparer.Compare(value, _list[num3]);
181 if (num4 == 0)
182 {
183 return num3;
184 }
185 if (num4 < 0)
186 {
187 num2 = num3 - 1;
188 }
189 else
190 {
191 num = num3 + 1;
192 }
193 }
194 return ~num;
195 }
196
197 public override void Clear()
198 {
199 if (_list.IsFixedSize)
200 {
202 }
203 _list.Clear();
204 _version++;
205 }
206
207 public override object Clone()
208 {
209 return new IListWrapper(_list);
210 }
211
212 public override bool Contains(object obj)
213 {
214 return _list.Contains(obj);
215 }
216
217 public override void CopyTo(Array array, int index)
218 {
220 }
221
222 public override void CopyTo(int index, Array array, int arrayIndex, int count)
223 {
224 if (array == null)
225 {
226 throw new ArgumentNullException("array");
227 }
228 if (index < 0 || arrayIndex < 0)
229 {
230 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "arrayIndex", SR.ArgumentOutOfRange_NeedNonNegNum);
231 }
232 if (count < 0)
233 {
235 }
236 if (array.Length - arrayIndex < count)
237 {
239 }
240 if (array.Rank != 1)
241 {
243 }
244 if (_list.Count - index < count)
245 {
247 }
248 for (int i = index; i < index + count; i++)
249 {
250 array.SetValue(_list[i], arrayIndex++);
251 }
252 }
253
254 public override IEnumerator GetEnumerator()
255 {
256 return _list.GetEnumerator();
257 }
258
259 public override IEnumerator GetEnumerator(int index, int count)
260 {
261 if (index < 0 || count < 0)
262 {
263 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
264 }
265 if (_list.Count - index < count)
266 {
268 }
269 return new IListWrapperEnumWrapper(this, index, count);
270 }
271
272 public override int IndexOf(object value)
273 {
274 return _list.IndexOf(value);
275 }
276
277 public override int IndexOf(object value, int startIndex)
278 {
280 }
281
282 public override int IndexOf(object value, int startIndex, int count)
283 {
284 if (startIndex < 0 || startIndex > Count)
285 {
287 }
288 if (count < 0 || startIndex > Count - count)
289 {
291 }
292 int num = startIndex + count;
293 if (value == null)
294 {
295 for (int i = startIndex; i < num; i++)
296 {
297 if (_list[i] == null)
298 {
299 return i;
300 }
301 }
302 return -1;
303 }
304 for (int j = startIndex; j < num; j++)
305 {
306 object obj = _list[j];
307 if (obj != null && obj.Equals(value))
308 {
309 return j;
310 }
311 }
312 return -1;
313 }
314
315 public override void Insert(int index, object obj)
316 {
318 _version++;
319 }
320
321 public override void InsertRange(int index, ICollection c)
322 {
323 if (c == null)
324 {
326 }
327 if (index < 0 || index > Count)
328 {
330 }
331 if (c.Count <= 0)
332 {
333 return;
334 }
335 if (_list is ArrayList arrayList)
336 {
337 arrayList.InsertRange(index, c);
338 }
339 else
340 {
341 IEnumerator enumerator = c.GetEnumerator();
342 while (enumerator.MoveNext())
343 {
344 _list.Insert(index++, enumerator.Current);
345 }
346 }
347 _version++;
348 }
349
350 public override int LastIndexOf(object value)
351 {
352 return LastIndexOf(value, _list.Count - 1, _list.Count);
353 }
354
355 public override int LastIndexOf(object value, int startIndex)
356 {
358 }
359
360 public override int LastIndexOf(object value, int startIndex, int count)
361 {
362 if (_list.Count == 0)
363 {
364 return -1;
365 }
366 if (startIndex < 0 || startIndex >= _list.Count)
367 {
369 }
370 if (count < 0 || count > startIndex + 1)
371 {
373 }
374 int num = startIndex - count + 1;
375 if (value == null)
376 {
377 for (int num2 = startIndex; num2 >= num; num2--)
378 {
379 if (_list[num2] == null)
380 {
381 return num2;
382 }
383 }
384 return -1;
385 }
386 for (int num3 = startIndex; num3 >= num; num3--)
387 {
388 object obj = _list[num3];
389 if (obj != null && obj.Equals(value))
390 {
391 return num3;
392 }
393 }
394 return -1;
395 }
396
397 public override void Remove(object value)
398 {
399 int num = IndexOf(value);
400 if (num >= 0)
401 {
402 RemoveAt(num);
403 }
404 }
405
406 public override void RemoveAt(int index)
407 {
409 _version++;
410 }
411
412 public override void RemoveRange(int index, int count)
413 {
414 if (index < 0 || count < 0)
415 {
416 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
417 }
418 if (_list.Count - index < count)
419 {
421 }
422 if (count > 0)
423 {
424 _version++;
425 }
426 while (count > 0)
427 {
429 count--;
430 }
431 }
432
433 public override void Reverse(int index, int count)
434 {
435 if (index < 0 || count < 0)
436 {
437 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
438 }
439 if (_list.Count - index < count)
440 {
442 }
443 int num = index;
444 int num2 = index + count - 1;
445 while (num < num2)
446 {
447 object value = _list[num];
448 _list[num++] = _list[num2];
449 _list[num2--] = value;
450 }
451 _version++;
452 }
453
454 public override void SetRange(int index, ICollection c)
455 {
456 if (c == null)
457 {
459 }
460 if (index < 0 || index > _list.Count - c.Count)
461 {
463 }
464 if (c.Count > 0)
465 {
466 IEnumerator enumerator = c.GetEnumerator();
467 while (enumerator.MoveNext())
468 {
469 _list[index++] = enumerator.Current;
470 }
471 _version++;
472 }
473 }
474
475 public override ArrayList GetRange(int index, int count)
476 {
477 if (index < 0 || count < 0)
478 {
479 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
480 }
481 if (_list.Count - index < count)
482 {
484 }
485 return new Range(this, index, count);
486 }
487
488 public override void Sort(int index, int count, IComparer comparer)
489 {
490 if (index < 0 || count < 0)
491 {
492 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
493 }
494 if (_list.Count - index < count)
495 {
497 }
498 object[] array = new object[count];
499 CopyTo(index, array, 0, count);
501 for (int i = 0; i < count; i++)
502 {
503 _list[i + index] = array[i];
504 }
505 _version++;
506 }
507
508 public override object[] ToArray()
509 {
510 if (Count == 0)
511 {
512 return Array.Empty<object>();
513 }
514 object[] array = new object[Count];
515 _list.CopyTo(array, 0);
516 return array;
517 }
518
519 public override Array ToArray(Type type)
520 {
521 if (type == null)
522 {
523 throw new ArgumentNullException("type");
524 }
526 _list.CopyTo(array, 0);
527 return array;
528 }
529
530 public override void TrimToSize()
531 {
532 }
533 }
534
535 private sealed class SyncArrayList : ArrayList
536 {
537 private readonly ArrayList _list;
538
539 private readonly object _root;
540
541 public override int Capacity
542 {
543 get
544 {
545 lock (_root)
546 {
547 return _list.Capacity;
548 }
549 }
550 set
551 {
552 lock (_root)
553 {
554 _list.Capacity = value;
555 }
556 }
557 }
558
559 public override int Count
560 {
561 get
562 {
563 lock (_root)
564 {
565 return _list.Count;
566 }
567 }
568 }
569
570 public override bool IsReadOnly => _list.IsReadOnly;
571
572 public override bool IsFixedSize => _list.IsFixedSize;
573
574 public override bool IsSynchronized => true;
575
576 public override object this[int index]
577 {
578 get
579 {
580 lock (_root)
581 {
582 return _list[index];
583 }
584 }
585 set
586 {
587 lock (_root)
588 {
589 _list[index] = value;
590 }
591 }
592 }
593
594 public override object SyncRoot => _root;
595
597 {
598 _list = list;
599 _root = list.SyncRoot;
600 }
601
602 public override int Add(object value)
603 {
604 lock (_root)
605 {
606 return _list.Add(value);
607 }
608 }
609
610 public override void AddRange(ICollection c)
611 {
612 lock (_root)
613 {
614 _list.AddRange(c);
615 }
616 }
617
618 public override int BinarySearch(object value)
619 {
620 lock (_root)
621 {
622 return _list.BinarySearch(value);
623 }
624 }
625
626 public override int BinarySearch(object value, IComparer comparer)
627 {
628 lock (_root)
629 {
631 }
632 }
633
634 public override int BinarySearch(int index, int count, object value, IComparer comparer)
635 {
636 lock (_root)
637 {
639 }
640 }
641
642 public override void Clear()
643 {
644 lock (_root)
645 {
646 _list.Clear();
647 }
648 }
649
650 public override object Clone()
651 {
652 lock (_root)
653 {
654 return new SyncArrayList((ArrayList)_list.Clone());
655 }
656 }
657
658 public override bool Contains(object item)
659 {
660 lock (_root)
661 {
662 return _list.Contains(item);
663 }
664 }
665
666 public override void CopyTo(Array array)
667 {
668 lock (_root)
669 {
671 }
672 }
673
674 public override void CopyTo(Array array, int index)
675 {
676 lock (_root)
677 {
679 }
680 }
681
682 public override void CopyTo(int index, Array array, int arrayIndex, int count)
683 {
684 lock (_root)
685 {
687 }
688 }
689
690 public override IEnumerator GetEnumerator()
691 {
692 lock (_root)
693 {
694 return _list.GetEnumerator();
695 }
696 }
697
698 public override IEnumerator GetEnumerator(int index, int count)
699 {
700 lock (_root)
701 {
703 }
704 }
705
706 public override int IndexOf(object value)
707 {
708 lock (_root)
709 {
710 return _list.IndexOf(value);
711 }
712 }
713
714 public override int IndexOf(object value, int startIndex)
715 {
716 lock (_root)
717 {
718 return _list.IndexOf(value, startIndex);
719 }
720 }
721
722 public override int IndexOf(object value, int startIndex, int count)
723 {
724 lock (_root)
725 {
727 }
728 }
729
730 public override void Insert(int index, object value)
731 {
732 lock (_root)
733 {
735 }
736 }
737
738 public override void InsertRange(int index, ICollection c)
739 {
740 lock (_root)
741 {
743 }
744 }
745
746 public override int LastIndexOf(object value)
747 {
748 lock (_root)
749 {
750 return _list.LastIndexOf(value);
751 }
752 }
753
754 public override int LastIndexOf(object value, int startIndex)
755 {
756 lock (_root)
757 {
759 }
760 }
761
762 public override int LastIndexOf(object value, int startIndex, int count)
763 {
764 lock (_root)
765 {
767 }
768 }
769
770 public override void Remove(object value)
771 {
772 lock (_root)
773 {
775 }
776 }
777
778 public override void RemoveAt(int index)
779 {
780 lock (_root)
781 {
783 }
784 }
785
786 public override void RemoveRange(int index, int count)
787 {
788 lock (_root)
789 {
791 }
792 }
793
794 public override void Reverse(int index, int count)
795 {
796 lock (_root)
797 {
799 }
800 }
801
802 public override void SetRange(int index, ICollection c)
803 {
804 lock (_root)
805 {
806 _list.SetRange(index, c);
807 }
808 }
809
810 public override ArrayList GetRange(int index, int count)
811 {
812 lock (_root)
813 {
814 return _list.GetRange(index, count);
815 }
816 }
817
818 public override void Sort()
819 {
820 lock (_root)
821 {
822 _list.Sort();
823 }
824 }
825
826 public override void Sort(IComparer comparer)
827 {
828 lock (_root)
829 {
831 }
832 }
833
834 public override void Sort(int index, int count, IComparer comparer)
835 {
836 lock (_root)
837 {
839 }
840 }
841
842 public override object[] ToArray()
843 {
844 lock (_root)
845 {
846 return _list.ToArray();
847 }
848 }
849
850 public override Array ToArray(Type type)
851 {
852 lock (_root)
853 {
854 return _list.ToArray(type);
855 }
856 }
857
858 public override void TrimToSize()
859 {
860 lock (_root)
861 {
863 }
864 }
865 }
866
867 private sealed class SyncIList : IList, ICollection, IEnumerable
868 {
869 private readonly IList _list;
870
871 private readonly object _root;
872
873 public int Count
874 {
875 get
876 {
877 lock (_root)
878 {
879 return _list.Count;
880 }
881 }
882 }
883
885
887
888 public bool IsSynchronized => true;
889
890 public object this[int index]
891 {
892 get
893 {
894 lock (_root)
895 {
896 return _list[index];
897 }
898 }
899 set
900 {
901 lock (_root)
902 {
903 _list[index] = value;
904 }
905 }
906 }
907
908 public object SyncRoot => _root;
909
911 {
912 _list = list;
913 _root = list.SyncRoot;
914 }
915
916 public int Add(object value)
917 {
918 lock (_root)
919 {
920 return _list.Add(value);
921 }
922 }
923
924 public void Clear()
925 {
926 lock (_root)
927 {
928 _list.Clear();
929 }
930 }
931
932 public bool Contains(object item)
933 {
934 lock (_root)
935 {
936 return _list.Contains(item);
937 }
938 }
939
940 public void CopyTo(Array array, int index)
941 {
942 lock (_root)
943 {
945 }
946 }
947
949 {
950 lock (_root)
951 {
952 return _list.GetEnumerator();
953 }
954 }
955
956 public int IndexOf(object value)
957 {
958 lock (_root)
959 {
960 return _list.IndexOf(value);
961 }
962 }
963
964 public void Insert(int index, object value)
965 {
966 lock (_root)
967 {
969 }
970 }
971
972 public void Remove(object value)
973 {
974 lock (_root)
975 {
977 }
978 }
979
980 public void RemoveAt(int index)
981 {
982 lock (_root)
983 {
985 }
986 }
987 }
988
990 {
991 private readonly IList _list;
992
993 public int Count => _list.Count;
994
996
997 public bool IsFixedSize => true;
998
1000
1001 public object this[int index]
1002 {
1003 get
1004 {
1005 return _list[index];
1006 }
1007 set
1008 {
1009 _list[index] = value;
1010 }
1011 }
1012
1013 public object SyncRoot => _list.SyncRoot;
1014
1016 {
1017 _list = l;
1018 }
1019
1020 public int Add(object obj)
1021 {
1023 }
1024
1025 public void Clear()
1026 {
1028 }
1029
1030 public bool Contains(object obj)
1031 {
1032 return _list.Contains(obj);
1033 }
1034
1035 public void CopyTo(Array array, int index)
1036 {
1038 }
1039
1041 {
1042 return _list.GetEnumerator();
1043 }
1044
1045 public int IndexOf(object value)
1046 {
1047 return _list.IndexOf(value);
1048 }
1049
1050 public void Insert(int index, object obj)
1051 {
1053 }
1054
1055 public void Remove(object value)
1056 {
1058 }
1059
1060 public void RemoveAt(int index)
1061 {
1063 }
1064 }
1065
1066 private sealed class FixedSizeArrayList : ArrayList
1067 {
1069
1070 public override int Count => _list.Count;
1071
1072 public override bool IsReadOnly => _list.IsReadOnly;
1073
1074 public override bool IsFixedSize => true;
1075
1076 public override bool IsSynchronized => _list.IsSynchronized;
1077
1078 public override object this[int index]
1079 {
1080 get
1081 {
1082 return _list[index];
1083 }
1084 set
1085 {
1086 _list[index] = value;
1088 }
1089 }
1090
1091 public override object SyncRoot => _list.SyncRoot;
1092
1093 public override int Capacity
1094 {
1095 get
1096 {
1097 return _list.Capacity;
1098 }
1099 set
1100 {
1102 }
1103 }
1104
1106 {
1107 _list = l;
1109 }
1110
1111 public override int Add(object obj)
1112 {
1114 }
1115
1116 public override void AddRange(ICollection c)
1117 {
1119 }
1120
1121 public override int BinarySearch(int index, int count, object value, IComparer comparer)
1122 {
1124 }
1125
1126 public override void Clear()
1127 {
1129 }
1130
1131 public override object Clone()
1132 {
1133 FixedSizeArrayList fixedSizeArrayList = new FixedSizeArrayList(_list);
1134 fixedSizeArrayList._list = (ArrayList)_list.Clone();
1135 return fixedSizeArrayList;
1136 }
1137
1138 public override bool Contains(object obj)
1139 {
1140 return _list.Contains(obj);
1141 }
1142
1143 public override void CopyTo(Array array, int index)
1144 {
1146 }
1147
1148 public override void CopyTo(int index, Array array, int arrayIndex, int count)
1149 {
1151 }
1152
1153 public override IEnumerator GetEnumerator()
1154 {
1155 return _list.GetEnumerator();
1156 }
1157
1158 public override IEnumerator GetEnumerator(int index, int count)
1159 {
1160 return _list.GetEnumerator(index, count);
1161 }
1162
1163 public override int IndexOf(object value)
1164 {
1165 return _list.IndexOf(value);
1166 }
1167
1168 public override int IndexOf(object value, int startIndex)
1169 {
1170 return _list.IndexOf(value, startIndex);
1171 }
1172
1173 public override int IndexOf(object value, int startIndex, int count)
1174 {
1176 }
1177
1178 public override void Insert(int index, object obj)
1179 {
1181 }
1182
1183 public override void InsertRange(int index, ICollection c)
1184 {
1186 }
1187
1188 public override int LastIndexOf(object value)
1189 {
1190 return _list.LastIndexOf(value);
1191 }
1192
1193 public override int LastIndexOf(object value, int startIndex)
1194 {
1196 }
1197
1198 public override int LastIndexOf(object value, int startIndex, int count)
1199 {
1201 }
1202
1203 public override void Remove(object value)
1204 {
1206 }
1207
1208 public override void RemoveAt(int index)
1209 {
1211 }
1212
1213 public override void RemoveRange(int index, int count)
1214 {
1216 }
1217
1218 public override void SetRange(int index, ICollection c)
1219 {
1220 _list.SetRange(index, c);
1222 }
1223
1224 public override ArrayList GetRange(int index, int count)
1225 {
1226 if (index < 0 || count < 0)
1227 {
1228 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
1229 }
1230 if (Count - index < count)
1231 {
1233 }
1234 return new Range(this, index, count);
1235 }
1236
1237 public override void Reverse(int index, int count)
1238 {
1241 }
1242
1243 public override void Sort(int index, int count, IComparer comparer)
1244 {
1247 }
1248
1249 public override object[] ToArray()
1250 {
1251 return _list.ToArray();
1252 }
1253
1254 public override Array ToArray(Type type)
1255 {
1256 return _list.ToArray(type);
1257 }
1258
1259 public override void TrimToSize()
1260 {
1262 }
1263 }
1264
1266 {
1267 private readonly IList _list;
1268
1269 public int Count => _list.Count;
1270
1271 public bool IsReadOnly => true;
1272
1273 public bool IsFixedSize => true;
1274
1276
1277 public object this[int index]
1278 {
1279 get
1280 {
1281 return _list[index];
1282 }
1283 set
1284 {
1286 }
1287 }
1288
1289 public object SyncRoot => _list.SyncRoot;
1290
1292 {
1293 _list = l;
1294 }
1295
1296 public int Add(object obj)
1297 {
1299 }
1300
1301 public void Clear()
1302 {
1304 }
1305
1306 public bool Contains(object obj)
1307 {
1308 return _list.Contains(obj);
1309 }
1310
1311 public void CopyTo(Array array, int index)
1312 {
1314 }
1315
1317 {
1318 return _list.GetEnumerator();
1319 }
1320
1321 public int IndexOf(object value)
1322 {
1323 return _list.IndexOf(value);
1324 }
1325
1326 public void Insert(int index, object obj)
1327 {
1329 }
1330
1331 public void Remove(object value)
1332 {
1334 }
1335
1336 public void RemoveAt(int index)
1337 {
1339 }
1340 }
1341
1342 private sealed class ReadOnlyArrayList : ArrayList
1343 {
1345
1346 public override int Count => _list.Count;
1347
1348 public override bool IsReadOnly => true;
1349
1350 public override bool IsFixedSize => true;
1351
1352 public override bool IsSynchronized => _list.IsSynchronized;
1353
1354 public override object this[int index]
1355 {
1356 get
1357 {
1358 return _list[index];
1359 }
1360 set
1361 {
1363 }
1364 }
1365
1366 public override object SyncRoot => _list.SyncRoot;
1367
1368 public override int Capacity
1369 {
1370 get
1371 {
1372 return _list.Capacity;
1373 }
1374 set
1375 {
1377 }
1378 }
1379
1381 {
1382 _list = l;
1383 }
1384
1385 public override int Add(object obj)
1386 {
1388 }
1389
1390 public override void AddRange(ICollection c)
1391 {
1393 }
1394
1395 public override int BinarySearch(int index, int count, object value, IComparer comparer)
1396 {
1398 }
1399
1400 public override void Clear()
1401 {
1403 }
1404
1405 public override object Clone()
1406 {
1407 ReadOnlyArrayList readOnlyArrayList = new ReadOnlyArrayList(_list);
1408 readOnlyArrayList._list = (ArrayList)_list.Clone();
1409 return readOnlyArrayList;
1410 }
1411
1412 public override bool Contains(object obj)
1413 {
1414 return _list.Contains(obj);
1415 }
1416
1417 public override void CopyTo(Array array, int index)
1418 {
1420 }
1421
1422 public override void CopyTo(int index, Array array, int arrayIndex, int count)
1423 {
1425 }
1426
1427 public override IEnumerator GetEnumerator()
1428 {
1429 return _list.GetEnumerator();
1430 }
1431
1432 public override IEnumerator GetEnumerator(int index, int count)
1433 {
1434 return _list.GetEnumerator(index, count);
1435 }
1436
1437 public override int IndexOf(object value)
1438 {
1439 return _list.IndexOf(value);
1440 }
1441
1442 public override int IndexOf(object value, int startIndex)
1443 {
1444 return _list.IndexOf(value, startIndex);
1445 }
1446
1447 public override int IndexOf(object value, int startIndex, int count)
1448 {
1450 }
1451
1452 public override void Insert(int index, object obj)
1453 {
1455 }
1456
1457 public override void InsertRange(int index, ICollection c)
1458 {
1460 }
1461
1462 public override int LastIndexOf(object value)
1463 {
1464 return _list.LastIndexOf(value);
1465 }
1466
1467 public override int LastIndexOf(object value, int startIndex)
1468 {
1470 }
1471
1472 public override int LastIndexOf(object value, int startIndex, int count)
1473 {
1475 }
1476
1477 public override void Remove(object value)
1478 {
1480 }
1481
1482 public override void RemoveAt(int index)
1483 {
1485 }
1486
1487 public override void RemoveRange(int index, int count)
1488 {
1490 }
1491
1492 public override void SetRange(int index, ICollection c)
1493 {
1495 }
1496
1497 public override ArrayList GetRange(int index, int count)
1498 {
1499 if (index < 0 || count < 0)
1500 {
1501 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
1502 }
1503 if (Count - index < count)
1504 {
1506 }
1507 return new Range(this, index, count);
1508 }
1509
1510 public override void Reverse(int index, int count)
1511 {
1513 }
1514
1515 public override void Sort(int index, int count, IComparer comparer)
1516 {
1518 }
1519
1520 public override object[] ToArray()
1521 {
1522 return _list.ToArray();
1523 }
1524
1525 public override Array ToArray(Type type)
1526 {
1527 return _list.ToArray(type);
1528 }
1529
1530 public override void TrimToSize()
1531 {
1533 }
1534 }
1535
1537 {
1538 private readonly ArrayList _list;
1539
1540 private int _index;
1541
1542 private readonly int _endIndex;
1543
1544 private readonly int _version;
1545
1546 private object _currentElement;
1547
1548 private readonly int _startIndex;
1549
1550 public object Current
1551 {
1552 get
1553 {
1554 if (_index < _startIndex)
1555 {
1557 }
1558 if (_index > _endIndex)
1559 {
1561 }
1562 return _currentElement;
1563 }
1564 }
1565
1567 {
1568 _list = list;
1570 _index = index - 1;
1572 _version = list._version;
1573 _currentElement = null;
1574 }
1575
1576 public object Clone()
1577 {
1578 return MemberwiseClone();
1579 }
1580
1581 public bool MoveNext()
1582 {
1583 if (_version != _list._version)
1584 {
1586 }
1587 if (_index < _endIndex)
1588 {
1590 return true;
1591 }
1592 _index = _endIndex + 1;
1593 return false;
1594 }
1595
1596 public void Reset()
1597 {
1598 if (_version != _list._version)
1599 {
1601 }
1602 _index = _startIndex - 1;
1603 }
1604 }
1605
1606 private sealed class Range : ArrayList
1607 {
1609
1610 private readonly int _baseIndex;
1611
1612 private int _baseSize;
1613
1614 private int _baseVersion;
1615
1616 public override int Capacity
1617 {
1618 get
1619 {
1620 return _baseList.Capacity;
1621 }
1622 set
1623 {
1624 if (value < Count)
1625 {
1627 }
1628 }
1629 }
1630
1631 public override int Count
1632 {
1633 get
1634 {
1636 return _baseSize;
1637 }
1638 }
1639
1640 public override bool IsReadOnly => _baseList.IsReadOnly;
1641
1642 public override bool IsFixedSize => _baseList.IsFixedSize;
1643
1644 public override bool IsSynchronized => _baseList.IsSynchronized;
1645
1646 public override object SyncRoot => _baseList.SyncRoot;
1647
1648 public override object this[int index]
1649 {
1650 get
1651 {
1653 if (index < 0 || index >= _baseSize)
1654 {
1656 }
1657 return _baseList[_baseIndex + index];
1658 }
1659 set
1660 {
1662 if (index < 0 || index >= _baseSize)
1663 {
1665 }
1668 }
1669 }
1670
1671 internal Range(ArrayList list, int index, int count)
1672 {
1673 _baseList = list;
1674 _baseIndex = index;
1675 _baseSize = count;
1676 _baseVersion = list._version;
1677 _version = list._version;
1678 }
1679
1687
1689 {
1690 _baseVersion++;
1691 _version++;
1692 }
1693
1694 public override int Add(object value)
1695 {
1699 return _baseSize++;
1700 }
1701
1702 public override void AddRange(ICollection c)
1703 {
1704 if (c == null)
1705 {
1706 throw new ArgumentNullException("c");
1707 }
1709 int count = c.Count;
1710 if (count > 0)
1711 {
1714 _baseSize += count;
1715 }
1716 }
1717
1718 public override int BinarySearch(int index, int count, object value, IComparer comparer)
1719 {
1720 if (index < 0 || count < 0)
1721 {
1722 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
1723 }
1724 if (_baseSize - index < count)
1725 {
1727 }
1730 if (num >= 0)
1731 {
1732 return num - _baseIndex;
1733 }
1734 return num + _baseIndex;
1735 }
1736
1737 public override void Clear()
1738 {
1740 if (_baseSize != 0)
1741 {
1744 _baseSize = 0;
1745 }
1746 }
1747
1748 public override object Clone()
1749 {
1751 Range range = new Range(_baseList, _baseIndex, _baseSize);
1752 range._baseList = (ArrayList)_baseList.Clone();
1753 return range;
1754 }
1755
1756 public override bool Contains(object item)
1757 {
1759 if (item == null)
1760 {
1761 for (int i = 0; i < _baseSize; i++)
1762 {
1763 if (_baseList[_baseIndex + i] == null)
1764 {
1765 return true;
1766 }
1767 }
1768 return false;
1769 }
1770 for (int j = 0; j < _baseSize; j++)
1771 {
1772 object obj = _baseList[_baseIndex + j];
1773 if (obj != null && obj.Equals(item))
1774 {
1775 return true;
1776 }
1777 }
1778 return false;
1779 }
1780
1781 public override void CopyTo(Array array, int index)
1782 {
1783 if (array == null)
1784 {
1785 throw new ArgumentNullException("array");
1786 }
1787 if (array.Rank != 1)
1788 {
1790 }
1791 if (index < 0)
1792 {
1794 }
1795 if (array.Length - index < _baseSize)
1796 {
1798 }
1801 }
1802
1803 public override void CopyTo(int index, Array array, int arrayIndex, int count)
1804 {
1805 if (array == null)
1806 {
1807 throw new ArgumentNullException("array");
1808 }
1809 if (array.Rank != 1)
1810 {
1812 }
1813 if (index < 0 || count < 0)
1814 {
1815 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
1816 }
1817 if (array.Length - arrayIndex < count)
1818 {
1820 }
1821 if (_baseSize - index < count)
1822 {
1824 }
1827 }
1828
1829 public override IEnumerator GetEnumerator()
1830 {
1831 return GetEnumerator(0, _baseSize);
1832 }
1833
1834 public override IEnumerator GetEnumerator(int index, int count)
1835 {
1836 if (index < 0 || count < 0)
1837 {
1838 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
1839 }
1840 if (_baseSize - index < count)
1841 {
1843 }
1846 }
1847
1848 public override ArrayList GetRange(int index, int count)
1849 {
1850 if (index < 0 || count < 0)
1851 {
1852 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
1853 }
1854 if (_baseSize - index < count)
1855 {
1857 }
1859 return new Range(this, index, count);
1860 }
1861
1862 public override int IndexOf(object value)
1863 {
1866 if (num >= 0)
1867 {
1868 return num - _baseIndex;
1869 }
1870 return -1;
1871 }
1872
1873 public override int IndexOf(object value, int startIndex)
1874 {
1875 if (startIndex < 0)
1876 {
1878 }
1879 if (startIndex > _baseSize)
1880 {
1882 }
1885 if (num >= 0)
1886 {
1887 return num - _baseIndex;
1888 }
1889 return -1;
1890 }
1891
1892 public override int IndexOf(object value, int startIndex, int count)
1893 {
1894 if (startIndex < 0 || startIndex > _baseSize)
1895 {
1897 }
1898 if (count < 0 || startIndex > _baseSize - count)
1899 {
1901 }
1904 if (num >= 0)
1905 {
1906 return num - _baseIndex;
1907 }
1908 return -1;
1909 }
1910
1911 public override void Insert(int index, object value)
1912 {
1913 if (index < 0 || index > _baseSize)
1914 {
1916 }
1920 _baseSize++;
1921 }
1922
1923 public override void InsertRange(int index, ICollection c)
1924 {
1925 if (index < 0 || index > _baseSize)
1926 {
1928 }
1929 if (c == null)
1930 {
1931 throw new ArgumentNullException("c");
1932 }
1934 int count = c.Count;
1935 if (count > 0)
1936 {
1938 _baseSize += count;
1940 }
1941 }
1942
1943 public override int LastIndexOf(object value)
1944 {
1947 if (num >= 0)
1948 {
1949 return num - _baseIndex;
1950 }
1951 return -1;
1952 }
1953
1954 public override int LastIndexOf(object value, int startIndex)
1955 {
1956 return LastIndexOf(value, startIndex, startIndex + 1);
1957 }
1958
1959 public override int LastIndexOf(object value, int startIndex, int count)
1960 {
1962 if (_baseSize == 0)
1963 {
1964 return -1;
1965 }
1966 if (startIndex >= _baseSize)
1967 {
1969 }
1970 if (startIndex < 0)
1971 {
1973 }
1975 if (num >= 0)
1976 {
1977 return num - _baseIndex;
1978 }
1979 return -1;
1980 }
1981
1982 public override void RemoveAt(int index)
1983 {
1984 if (index < 0 || index >= _baseSize)
1985 {
1987 }
1991 _baseSize--;
1992 }
1993
1994 public override void RemoveRange(int index, int count)
1995 {
1996 if (index < 0 || count < 0)
1997 {
1998 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
1999 }
2000 if (_baseSize - index < count)
2001 {
2003 }
2005 if (count > 0)
2006 {
2009 _baseSize -= count;
2010 }
2011 }
2012
2013 public override void Reverse(int index, int count)
2014 {
2015 if (index < 0 || count < 0)
2016 {
2017 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
2018 }
2019 if (_baseSize - index < count)
2020 {
2022 }
2026 }
2027
2028 public override void SetRange(int index, ICollection c)
2029 {
2031 if (index < 0 || index >= _baseSize)
2032 {
2034 }
2036 if (c.Count > 0)
2037 {
2039 }
2040 }
2041
2042 public override void Sort(int index, int count, IComparer comparer)
2043 {
2044 if (index < 0 || count < 0)
2045 {
2046 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
2047 }
2048 if (_baseSize - index < count)
2049 {
2051 }
2055 }
2056
2057 public override object[] ToArray()
2058 {
2060 if (_baseSize == 0)
2061 {
2062 return Array.Empty<object>();
2063 }
2064 object[] array = new object[_baseSize];
2066 return array;
2067 }
2068
2069 public override Array ToArray(Type type)
2070 {
2071 if (type == null)
2072 {
2073 throw new ArgumentNullException("type");
2074 }
2078 return array;
2079 }
2080
2081 public override void TrimToSize()
2082 {
2084 }
2085 }
2086
2088 {
2089 private readonly ArrayList _list;
2090
2091 private int _index;
2092
2093 private readonly int _version;
2094
2095 private object _currentElement;
2096
2097 private readonly bool _isArrayList;
2098
2099 private static readonly object s_dummyObject = new object();
2100
2101 public object Current
2102 {
2103 get
2104 {
2105 object currentElement = _currentElement;
2106 if (s_dummyObject == currentElement)
2107 {
2108 if (_index == -1)
2109 {
2111 }
2113 }
2114 return currentElement;
2115 }
2116 }
2117
2119 {
2120 _list = list;
2121 _index = -1;
2122 _version = list._version;
2123 _isArrayList = list.GetType() == typeof(ArrayList);
2125 }
2126
2127 public object Clone()
2128 {
2129 return MemberwiseClone();
2130 }
2131
2132 public bool MoveNext()
2133 {
2134 if (_version != _list._version)
2135 {
2137 }
2138 if (_isArrayList)
2139 {
2140 if (_index < _list._size - 1)
2141 {
2143 return true;
2144 }
2146 _index = _list._size;
2147 return false;
2148 }
2149 if (_index < _list.Count - 1)
2150 {
2152 return true;
2153 }
2154 _index = _list.Count;
2156 return false;
2157 }
2158
2159 public void Reset()
2160 {
2161 if (_version != _list._version)
2162 {
2164 }
2166 _index = -1;
2167 }
2168 }
2169
2170 internal sealed class ArrayListDebugView
2171 {
2172 private readonly ArrayList _arrayList;
2173
2174 [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
2175 public object[] Items => _arrayList.ToArray();
2176
2178 {
2179 if (arrayList == null)
2180 {
2181 throw new ArgumentNullException("arrayList");
2182 }
2183 _arrayList = arrayList;
2184 }
2185 }
2186
2187 private object[] _items;
2188
2189 private int _size;
2190
2191 private int _version;
2192
2193 public virtual int Capacity
2194 {
2195 get
2196 {
2197 return _items.Length;
2198 }
2199 set
2200 {
2201 if (value < _size)
2202 {
2204 }
2205 if (value == _items.Length)
2206 {
2207 return;
2208 }
2209 if (value > 0)
2210 {
2211 object[] array = new object[value];
2212 if (_size > 0)
2213 {
2215 }
2216 _items = array;
2217 }
2218 else
2219 {
2220 _items = new object[4];
2221 }
2222 }
2223 }
2224
2225 public virtual int Count => _size;
2226
2227 public virtual bool IsFixedSize => false;
2228
2229 public virtual bool IsReadOnly => false;
2230
2231 public virtual bool IsSynchronized => false;
2232
2233 public virtual object SyncRoot => this;
2234
2235 public virtual object? this[int index]
2236 {
2237 get
2238 {
2239 if (index < 0 || index >= _size)
2240 {
2242 }
2243 return _items[index];
2244 }
2245 set
2246 {
2247 if (index < 0 || index >= _size)
2248 {
2250 }
2251 _items[index] = value;
2252 _version++;
2253 }
2254 }
2255
2256 public ArrayList()
2257 {
2258 _items = Array.Empty<object>();
2259 }
2260
2262 {
2263 if (capacity < 0)
2264 {
2266 }
2267 if (capacity == 0)
2268 {
2269 _items = Array.Empty<object>();
2270 }
2271 else
2272 {
2273 _items = new object[capacity];
2274 }
2275 }
2276
2278 {
2279 if (c == null)
2280 {
2282 }
2283 int count = c.Count;
2284 if (count == 0)
2285 {
2286 _items = Array.Empty<object>();
2287 return;
2288 }
2289 _items = new object[count];
2290 AddRange(c);
2291 }
2292
2294 {
2295 if (list == null)
2296 {
2297 throw new ArgumentNullException("list");
2298 }
2299 return new IListWrapper(list);
2300 }
2301
2302 public virtual int Add(object? value)
2303 {
2304 if (_size == _items.Length)
2305 {
2306 EnsureCapacity(_size + 1);
2307 }
2308 _items[_size] = value;
2309 _version++;
2310 return _size++;
2311 }
2312
2313 public virtual void AddRange(ICollection c)
2314 {
2315 InsertRange(_size, c);
2316 }
2317
2318 public virtual int BinarySearch(int index, int count, object? value, IComparer? comparer)
2319 {
2320 if (index < 0)
2321 {
2323 }
2324 if (count < 0)
2325 {
2327 }
2328 if (_size - index < count)
2329 {
2331 }
2333 }
2334
2335 public virtual int BinarySearch(object? value)
2336 {
2337 return BinarySearch(0, Count, value, null);
2338 }
2339
2340 public virtual int BinarySearch(object? value, IComparer? comparer)
2341 {
2342 return BinarySearch(0, Count, value, comparer);
2343 }
2344
2345 public virtual void Clear()
2346 {
2347 if (_size > 0)
2348 {
2349 Array.Clear(_items, 0, _size);
2350 _size = 0;
2351 }
2352 _version++;
2353 }
2354
2355 public virtual object Clone()
2356 {
2357 ArrayList arrayList = new ArrayList(_size);
2358 arrayList._size = _size;
2359 arrayList._version = _version;
2360 Array.Copy(_items, arrayList._items, _size);
2361 return arrayList;
2362 }
2363
2364 public virtual bool Contains(object? item)
2365 {
2366 if (item == null)
2367 {
2368 for (int i = 0; i < _size; i++)
2369 {
2370 if (_items[i] == null)
2371 {
2372 return true;
2373 }
2374 }
2375 return false;
2376 }
2377 for (int j = 0; j < _size; j++)
2378 {
2379 object obj = _items[j];
2380 if (obj != null && obj.Equals(item))
2381 {
2382 return true;
2383 }
2384 }
2385 return false;
2386 }
2387
2388 public virtual void CopyTo(Array array)
2389 {
2390 CopyTo(array, 0);
2391 }
2392
2393 public virtual void CopyTo(Array array, int arrayIndex)
2394 {
2395 if (array != null && array.Rank != 1)
2396 {
2398 }
2400 }
2401
2402 public virtual void CopyTo(int index, Array array, int arrayIndex, int count)
2403 {
2404 if (_size - index < count)
2405 {
2407 }
2408 if (array != null && array.Rank != 1)
2409 {
2411 }
2413 }
2414
2415 private void EnsureCapacity(int min)
2416 {
2417 if (_items.Length < min)
2418 {
2419 int num = ((_items.Length == 0) ? 4 : (_items.Length * 2));
2420 if ((uint)num > Array.MaxLength)
2421 {
2422 num = Array.MaxLength;
2423 }
2424 if (num < min)
2425 {
2426 num = min;
2427 }
2428 Capacity = num;
2429 }
2430 }
2431
2432 public static IList FixedSize(IList list)
2433 {
2434 if (list == null)
2435 {
2436 throw new ArgumentNullException("list");
2437 }
2438 return new FixedSizeList(list);
2439 }
2440
2442 {
2443 if (list == null)
2444 {
2445 throw new ArgumentNullException("list");
2446 }
2447 return new FixedSizeArrayList(list);
2448 }
2449
2451 {
2452 return new ArrayListEnumeratorSimple(this);
2453 }
2454
2455 public virtual IEnumerator GetEnumerator(int index, int count)
2456 {
2457 if (index < 0)
2458 {
2460 }
2461 if (count < 0)
2462 {
2464 }
2465 if (_size - index < count)
2466 {
2468 }
2469 return new ArrayListEnumerator(this, index, count);
2470 }
2471
2472 public virtual int IndexOf(object? value)
2473 {
2474 return Array.IndexOf(_items, value, 0, _size);
2475 }
2476
2477 public virtual int IndexOf(object? value, int startIndex)
2478 {
2479 if (startIndex > _size)
2480 {
2482 }
2484 }
2485
2486 public virtual int IndexOf(object? value, int startIndex, int count)
2487 {
2488 if (startIndex > _size)
2489 {
2491 }
2492 if (count < 0 || startIndex > _size - count)
2493 {
2495 }
2497 }
2498
2499 public virtual void Insert(int index, object? value)
2500 {
2501 if (index < 0 || index > _size)
2502 {
2504 }
2505 if (_size == _items.Length)
2506 {
2507 EnsureCapacity(_size + 1);
2508 }
2509 if (index < _size)
2510 {
2512 }
2513 _items[index] = value;
2514 _size++;
2515 _version++;
2516 }
2517
2518 public virtual void InsertRange(int index, ICollection c)
2519 {
2520 if (c == null)
2521 {
2523 }
2524 if (index < 0 || index > _size)
2525 {
2527 }
2528 int count = c.Count;
2529 if (count > 0)
2530 {
2532 if (index < _size)
2533 {
2535 }
2536 object[] array = new object[count];
2537 c.CopyTo(array, 0);
2538 array.CopyTo(_items, index);
2539 _size += count;
2540 _version++;
2541 }
2542 }
2543
2544 public virtual int LastIndexOf(object? value)
2545 {
2546 return LastIndexOf(value, _size - 1, _size);
2547 }
2548
2549 public virtual int LastIndexOf(object? value, int startIndex)
2550 {
2551 if (startIndex >= _size)
2552 {
2554 }
2555 return LastIndexOf(value, startIndex, startIndex + 1);
2556 }
2557
2558 public virtual int LastIndexOf(object? value, int startIndex, int count)
2559 {
2560 if (Count != 0 && (startIndex < 0 || count < 0))
2561 {
2562 throw new ArgumentOutOfRangeException((startIndex < 0) ? "startIndex" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
2563 }
2564 if (_size == 0)
2565 {
2566 return -1;
2567 }
2568 if (startIndex >= _size || count > startIndex + 1)
2569 {
2571 }
2573 }
2574
2575 public static IList ReadOnly(IList list)
2576 {
2577 if (list == null)
2578 {
2579 throw new ArgumentNullException("list");
2580 }
2581 return new ReadOnlyList(list);
2582 }
2583
2585 {
2586 if (list == null)
2587 {
2588 throw new ArgumentNullException("list");
2589 }
2590 return new ReadOnlyArrayList(list);
2591 }
2592
2593 public virtual void Remove(object? obj)
2594 {
2595 int num = IndexOf(obj);
2596 if (num >= 0)
2597 {
2598 RemoveAt(num);
2599 }
2600 }
2601
2602 public virtual void RemoveAt(int index)
2603 {
2604 if (index < 0 || index >= _size)
2605 {
2607 }
2608 _size--;
2609 if (index < _size)
2610 {
2612 }
2613 _items[_size] = null;
2614 _version++;
2615 }
2616
2617 public virtual void RemoveRange(int index, int count)
2618 {
2619 if (index < 0)
2620 {
2622 }
2623 if (count < 0)
2624 {
2626 }
2627 if (_size - index < count)
2628 {
2630 }
2631 if (count > 0)
2632 {
2633 int num = _size;
2634 _size -= count;
2635 if (index < _size)
2636 {
2638 }
2639 while (num > _size)
2640 {
2641 _items[--num] = null;
2642 }
2643 _version++;
2644 }
2645 }
2646
2647 public static ArrayList Repeat(object? value, int count)
2648 {
2649 if (count < 0)
2650 {
2652 }
2653 ArrayList arrayList = new ArrayList((count > 4) ? count : 4);
2654 for (int i = 0; i < count; i++)
2655 {
2656 arrayList.Add(value);
2657 }
2658 return arrayList;
2659 }
2660
2661 public virtual void Reverse()
2662 {
2663 Reverse(0, Count);
2664 }
2665
2666 public virtual void Reverse(int index, int count)
2667 {
2668 if (index < 0)
2669 {
2671 }
2672 if (count < 0)
2673 {
2675 }
2676 if (_size - index < count)
2677 {
2679 }
2681 _version++;
2682 }
2683
2684 public virtual void SetRange(int index, ICollection c)
2685 {
2686 if (c == null)
2687 {
2689 }
2690 int count = c.Count;
2691 if (index < 0 || index > _size - count)
2692 {
2694 }
2695 if (count > 0)
2696 {
2697 c.CopyTo(_items, index);
2698 _version++;
2699 }
2700 }
2701
2702 public virtual ArrayList GetRange(int index, int count)
2703 {
2704 if (index < 0 || count < 0)
2705 {
2706 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", SR.ArgumentOutOfRange_NeedNonNegNum);
2707 }
2708 if (_size - index < count)
2709 {
2711 }
2712 return new Range(this, index, count);
2713 }
2714
2715 public virtual void Sort()
2716 {
2718 }
2719
2720 public virtual void Sort(IComparer? comparer)
2721 {
2722 Sort(0, Count, comparer);
2723 }
2724
2725 public virtual void Sort(int index, int count, IComparer? comparer)
2726 {
2727 if (index < 0)
2728 {
2730 }
2731 if (count < 0)
2732 {
2734 }
2735 if (_size - index < count)
2736 {
2738 }
2740 _version++;
2741 }
2742
2744 {
2745 if (list == null)
2746 {
2747 throw new ArgumentNullException("list");
2748 }
2749 return new SyncIList(list);
2750 }
2751
2753 {
2754 if (list == null)
2755 {
2756 throw new ArgumentNullException("list");
2757 }
2758 return new SyncArrayList(list);
2759 }
2760
2761 public virtual object?[] ToArray()
2762 {
2763 if (_size == 0)
2764 {
2765 return Array.Empty<object>();
2766 }
2767 object[] array = new object[_size];
2769 return array;
2770 }
2771
2772 public virtual Array ToArray(Type type)
2773 {
2774 if (type == null)
2775 {
2776 throw new ArgumentNullException("type");
2777 }
2780 return array;
2781 }
2782
2783 public virtual void TrimToSize()
2784 {
2785 Capacity = _size;
2786 }
2787}
static void Sort(Array array)
Definition Array.cs:2329
static void Reverse(Array array)
Definition Array.cs:2207
int IList. IndexOf(object value)
Definition Array.cs:1228
static int MaxLength
Definition Array.cs:471
static int LastIndexOf(Array array, object? value)
Definition Array.cs:1995
static unsafe Array CreateInstance(Type elementType, int length)
Definition Array.cs:473
static unsafe void Clear(Array array)
Definition Array.cs:755
static int BinarySearch(Array array, object? value)
Definition Array.cs:1320
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
ArrayListEnumerator(ArrayList list, int index, int count)
override void SetRange(int index, ICollection c)
override void RemoveRange(int index, int count)
override IEnumerator GetEnumerator(int index, int count)
override int LastIndexOf(object value, int startIndex)
override int IndexOf(object value, int startIndex, int count)
override void InsertRange(int index, ICollection c)
override int BinarySearch(int index, int count, object value, IComparer comparer)
override void CopyTo(int index, Array array, int arrayIndex, int count)
override void Sort(int index, int count, IComparer comparer)
override void Reverse(int index, int count)
override ArrayList GetRange(int index, int count)
override void CopyTo(Array array, int index)
override int LastIndexOf(object value, int startIndex, int count)
override int IndexOf(object value, int startIndex)
override void Insert(int index, object obj)
void CopyTo(Array array, int index)
void Insert(int index, object obj)
IListWrapperEnumWrapper(IListWrapper listWrapper, int startIndex, int count)
Definition ArrayList.cs:42
override void CopyTo(int index, Array array, int arrayIndex, int count)
Definition ArrayList.cs:222
override void SetRange(int index, ICollection c)
Definition ArrayList.cs:454
override Array ToArray(Type type)
Definition ArrayList.cs:519
override void RemoveAt(int index)
Definition ArrayList.cs:406
override int IndexOf(object value)
Definition ArrayList.cs:272
override void CopyTo(Array array, int index)
Definition ArrayList.cs:217
override int LastIndexOf(object value)
Definition ArrayList.cs:350
override void AddRange(ICollection c)
Definition ArrayList.cs:156
override void Reverse(int index, int count)
Definition ArrayList.cs:433
override void Insert(int index, object obj)
Definition ArrayList.cs:315
override void Remove(object value)
Definition ArrayList.cs:397
override int IndexOf(object value, int startIndex, int count)
Definition ArrayList.cs:282
override void InsertRange(int index, ICollection c)
Definition ArrayList.cs:321
override void RemoveRange(int index, int count)
Definition ArrayList.cs:412
override int LastIndexOf(object value, int startIndex, int count)
Definition ArrayList.cs:360
override int BinarySearch(int index, int count, object value, IComparer comparer)
Definition ArrayList.cs:161
override IEnumerator GetEnumerator(int index, int count)
Definition ArrayList.cs:259
override bool Contains(object obj)
Definition ArrayList.cs:212
override int IndexOf(object value, int startIndex)
Definition ArrayList.cs:277
override void Sort(int index, int count, IComparer comparer)
Definition ArrayList.cs:488
override ArrayList GetRange(int index, int count)
Definition ArrayList.cs:475
override int LastIndexOf(object value, int startIndex)
Definition ArrayList.cs:355
override void RemoveRange(int index, int count)
override void AddRange(ICollection c)
override int LastIndexOf(object value)
override void RemoveAt(int index)
override int IndexOf(object value)
override int Add(object value)
override int LastIndexOf(object value, int startIndex, int count)
override void Sort(int index, int count, IComparer comparer)
override int IndexOf(object value, int startIndex, int count)
override IEnumerator GetEnumerator()
override int BinarySearch(int index, int count, object value, IComparer comparer)
override void Insert(int index, object value)
override ArrayList GetRange(int index, int count)
override Array ToArray(Type type)
override IEnumerator GetEnumerator(int index, int count)
override void CopyTo(Array array, int index)
override void SetRange(int index, ICollection c)
override int IndexOf(object value, int startIndex)
override bool Contains(object item)
override void CopyTo(int index, Array array, int arrayIndex, int count)
Range(ArrayList list, int index, int count)
override void InsertRange(int index, ICollection c)
override void Reverse(int index, int count)
override int LastIndexOf(object value, int startIndex)
override void Reverse(int index, int count)
override void Sort(int index, int count, IComparer comparer)
override IEnumerator GetEnumerator(int index, int count)
override void AddRange(ICollection c)
override int IndexOf(object value, int startIndex)
override int LastIndexOf(object value, int startIndex)
override int LastIndexOf(object value, int startIndex, int count)
override void RemoveRange(int index, int count)
override void InsertRange(int index, ICollection c)
override int BinarySearch(int index, int count, object value, IComparer comparer)
override void Insert(int index, object obj)
override int IndexOf(object value, int startIndex, int count)
override ArrayList GetRange(int index, int count)
override void CopyTo(int index, Array array, int arrayIndex, int count)
override void CopyTo(Array array, int index)
override void SetRange(int index, ICollection c)
void Insert(int index, object obj)
void CopyTo(Array array, int index)
override int LastIndexOf(object value, int startIndex, int count)
Definition ArrayList.cs:762
override int IndexOf(object value, int startIndex)
Definition ArrayList.cs:714
override void Reverse(int index, int count)
Definition ArrayList.cs:794
override void RemoveRange(int index, int count)
Definition ArrayList.cs:786
override bool Contains(object item)
Definition ArrayList.cs:658
override int IndexOf(object value, int startIndex, int count)
Definition ArrayList.cs:722
override IEnumerator GetEnumerator(int index, int count)
Definition ArrayList.cs:698
override void CopyTo(Array array)
Definition ArrayList.cs:666
override void CopyTo(int index, Array array, int arrayIndex, int count)
Definition ArrayList.cs:682
override int IndexOf(object value)
Definition ArrayList.cs:706
override void InsertRange(int index, ICollection c)
Definition ArrayList.cs:738
override void SetRange(int index, ICollection c)
Definition ArrayList.cs:802
override void AddRange(ICollection c)
Definition ArrayList.cs:610
override Array ToArray(Type type)
Definition ArrayList.cs:850
override void CopyTo(Array array, int index)
Definition ArrayList.cs:674
override int LastIndexOf(object value)
Definition ArrayList.cs:746
override int LastIndexOf(object value, int startIndex)
Definition ArrayList.cs:754
override void Insert(int index, object value)
Definition ArrayList.cs:730
override void Remove(object value)
Definition ArrayList.cs:770
override int BinarySearch(int index, int count, object value, IComparer comparer)
Definition ArrayList.cs:634
override void Sort(int index, int count, IComparer comparer)
Definition ArrayList.cs:834
override int BinarySearch(object value, IComparer comparer)
Definition ArrayList.cs:626
override void Sort(IComparer comparer)
Definition ArrayList.cs:826
override int BinarySearch(object value)
Definition ArrayList.cs:618
override ArrayList GetRange(int index, int count)
Definition ArrayList.cs:810
void CopyTo(Array array, int index)
Definition ArrayList.cs:940
void Insert(int index, object value)
Definition ArrayList.cs:964
virtual void CopyTo(Array array, int arrayIndex)
virtual ? object[] ToArray()
static ArrayList FixedSize(ArrayList list)
virtual void AddRange(ICollection c)
virtual void CopyTo(int index, Array array, int arrayIndex, int count)
static ArrayList ReadOnly(ArrayList list)
static ArrayList Synchronized(ArrayList list)
virtual int LastIndexOf(object? value, int startIndex, int count)
static IList Synchronized(IList list)
virtual void Sort(int index, int count, IComparer? comparer)
virtual void SetRange(int index, ICollection c)
virtual void Remove(object? obj)
virtual IEnumerator GetEnumerator()
virtual int BinarySearch(object? value, IComparer? comparer)
virtual int Add(object? value)
virtual int LastIndexOf(object? value)
virtual ArrayList GetRange(int index, int count)
static IList ReadOnly(IList list)
virtual Array ToArray(Type type)
virtual void RemoveRange(int index, int count)
virtual void RemoveAt(int index)
static ArrayList Adapter(IList list)
virtual bool Contains(object? item)
virtual void Sort(IComparer? comparer)
virtual void CopyTo(Array array)
static ArrayList Repeat(object? value, int count)
virtual int IndexOf(object? value, int startIndex, int count)
virtual void Reverse(int index, int count)
virtual IEnumerator GetEnumerator(int index, int count)
virtual int IndexOf(object? value, int startIndex)
virtual int LastIndexOf(object? value, int startIndex)
static IList FixedSize(IList list)
virtual int BinarySearch(object? value)
virtual void Insert(int index, object? value)
virtual int BinarySearch(int index, int count, object? value, IComparer? comparer)
virtual void InsertRange(int index, ICollection c)
virtual int IndexOf(object? value)
static readonly Comparer Default
Definition Comparer.cs:13
static string InvalidOperation_UnderlyingArrayListChanged
Definition SR.cs:1528
static string ArgumentOutOfRange_Index
Definition SR.cs:30
static string NotSupported_RangeCollection
Definition SR.cs:1704
static string InvalidOperation_EnumNotStarted
Definition SR.cs:46
static string ArgumentOutOfRange_SmallCapacity
Definition SR.cs:34
static string NotSupported_ReadOnlyCollection
Definition SR.cs:28
static string ArgumentOutOfRange_Count
Definition SR.cs:986
static string ArgumentNull_Collection
Definition SR.cs:944
static string InvalidOperation_EnumEnded
Definition SR.cs:42
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string ArgumentOutOfRange_BiggerThanCollection
Definition SR.cs:56
static string InvalidOperation_EnumFailedVersion
Definition SR.cs:44
static string Arg_RankMultiDimNotSupported
Definition SR.cs:18
static string NotSupported_FixedSizeCollection
Definition SR.cs:1674
static string ArgumentOutOfRange_MustBeNonNegNum
Definition SR.cs:1066
static string Argument_InvalidOffLen
Definition SR.cs:22
static string ArgumentOutOfRange_NeedNonNegNum
Definition SR.cs:32
Definition SR.cs:7
void CopyTo(Array array, int index)
void RemoveAt(int index)
void Insert(int index, object? value)
int Add(object? value)
bool Contains(object? value)
void Remove(object? value)
int IndexOf(object? value)