PageRenderTime 48ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/corlib/System.Collections/ArrayList.cs

https://bitbucket.org/cosi2/dotnetanywhere-wb
C# | 214 lines | 170 code | 44 blank | 0 comment | 4 complexity | 8ecbba2cdae9b02830c89b5e670eaf4a MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. #if LOCALTEST
  4. using System.Collections;
  5. namespace System_.Collections {
  6. #else
  7. namespace System.Collections {
  8. #endif
  9. public class ArrayList : IList, ICollection, IEnumerable, ICloneable {
  10. private List<object> list;
  11. public ArrayList() {
  12. this.list = new List<object>();
  13. }
  14. public ArrayList(ICollection c) {
  15. if (c == null) {
  16. throw new ArgumentNullException();
  17. }
  18. this.list = new List<object>(c.Count);
  19. foreach (object o in c) {
  20. this.list.Add(o);
  21. }
  22. }
  23. public ArrayList(int capacity) {
  24. this.list = new List<object>(capacity);
  25. }
  26. public virtual int Add(object value) {
  27. return this.list.Add(value);
  28. }
  29. public virtual void AddRange(ICollection c) {
  30. if (c == null) {
  31. throw new ArgumentNullException();
  32. }
  33. foreach (object o in c) {
  34. this.list.Add(o);
  35. }
  36. }
  37. public virtual void Clear() {
  38. this.list.Clear();
  39. }
  40. public virtual object Clone() {
  41. throw new NotImplementedException();
  42. }
  43. public virtual bool Contains(object item) {
  44. return this.list.Contains(item);
  45. }
  46. public virtual void CopyTo(Array array) {
  47. this.list.CopyTo(array, 0);
  48. }
  49. public virtual void CopyTo(Array array, int arrayIndex) {
  50. throw new NotImplementedException();
  51. }
  52. public virtual void CopyTo(int index, Array array, int arrayIndex, int count){
  53. throw new NotImplementedException();
  54. }
  55. public virtual IEnumerator GetEnumerator() {
  56. return this.list.GetEnumerator();
  57. }
  58. public virtual IEnumerable GetEnumerator(int index, int count) {
  59. throw new NotImplementedException();
  60. }
  61. public virtual ArrayList GetRange(int index, int count) {
  62. throw new NotImplementedException();
  63. }
  64. public virtual int IndexOf(object value) {
  65. return this.list.IndexOf(value);
  66. }
  67. public virtual int IndexOf(object value, int startIndex) {
  68. return this.list.IndexOf(value, startIndex);
  69. }
  70. public virtual int IndexOf(object value, int startIndex, int count) {
  71. return this.list.IndexOf(value, startIndex, count);
  72. }
  73. public virtual void Insert(int index, object value) {
  74. this.list.Insert(index, value);
  75. }
  76. public virtual void InsertRange(int index, ICollection c) {
  77. List<object> insert = new List<object>(c.Count);
  78. foreach (object o in c) {
  79. insert.Add(o);
  80. }
  81. this.list.InsertRange(index, insert);
  82. }
  83. public virtual int LastIndexOf(object value) {
  84. throw new NotImplementedException();
  85. }
  86. public virtual int LastIndexOf(object value, int startIndex) {
  87. throw new NotImplementedException();
  88. }
  89. public virtual int LastIndexOf(object value, int startIndex, int count) {
  90. throw new NotImplementedException();
  91. }
  92. public virtual void Remove(object obj) {
  93. this.list.Remove(obj);
  94. }
  95. public virtual void RemoveAt(int index) {
  96. this.list.RemoveAt(index);
  97. }
  98. public virtual void RemoveRange(int index, int count) {
  99. throw new NotImplementedException();
  100. }
  101. public virtual void Reverse() {
  102. throw new NotImplementedException();
  103. }
  104. public virtual void Reverse(int index, int count) {
  105. throw new NotImplementedException();
  106. }
  107. public virtual void SetRange(int index, ICollection c) {
  108. throw new NotImplementedException();
  109. }
  110. public virtual void Sort() {
  111. throw new NotImplementedException();
  112. }
  113. public virtual void Sort(IComparer comparer) {
  114. throw new NotImplementedException();
  115. }
  116. public virtual void Sort(int index, int count, IComparer comparer) {
  117. throw new NotImplementedException();
  118. }
  119. public virtual object[] ToArray() {
  120. throw new NotImplementedException();
  121. }
  122. public virtual Array ToArray(Type type) {
  123. throw new NotImplementedException();
  124. }
  125. public virtual void TromToSize() {
  126. throw new NotImplementedException();
  127. }
  128. public virtual int Capacity {
  129. get {
  130. return this.list.Capacity;
  131. }
  132. set {
  133. this.list.Capacity = value;
  134. }
  135. }
  136. public virtual int Count {
  137. get {
  138. return this.list.Count;
  139. }
  140. }
  141. public virtual bool IsFixedSize {
  142. get {
  143. return false;
  144. }
  145. }
  146. public virtual bool IsReadOnly {
  147. get {
  148. return false;
  149. }
  150. }
  151. public virtual bool IsSynchronized {
  152. get {
  153. return false;
  154. }
  155. }
  156. public virtual object this[int index] {
  157. get {
  158. return this.list[index];
  159. }
  160. set {
  161. this.list[index] = value;
  162. }
  163. }
  164. public virtual object SyncRoot {
  165. get {
  166. return this;
  167. }
  168. }
  169. }
  170. }