CodeParameterDeclarationExpressionCollection.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. //
  2. // System.CodeDom CodeParameterDeclarationExpressionCollection Class implementation
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. //
  7. // (C) 2001 Ximian, Inc.
  8. //
  9. namespace System.CodeDom {
  10. using System.Collections;
  11. [Serializable]
  12. public class CodeParameterDeclarationExpressionCollection : IList, ICollection, IEnumerable {
  13. ArrayList parameterDeclExprs;
  14. //
  15. // Constructors
  16. //
  17. public CodeParameterDeclarationExpressionCollection ()
  18. {
  19. parameterDeclExprs = new ArrayList ();
  20. }
  21. //
  22. // Properties
  23. //
  24. public int Count {
  25. get {
  26. return parameterDeclExprs.Count;
  27. }
  28. }
  29. public bool IsFixedSize {
  30. get {
  31. return true;
  32. }
  33. }
  34. //
  35. // Methods
  36. //
  37. public void Add (CodeParameterDeclarationExpression value)
  38. {
  39. parameterDeclExprs.Add (value);
  40. }
  41. public void AddRange (CodeParameterDeclarationExpression [] values)
  42. {
  43. foreach (CodeParameterDeclarationExpression ca in values)
  44. parameterDeclExprs.Add (ca);
  45. }
  46. public void Clear ()
  47. {
  48. parameterDeclExprs.Clear ();
  49. }
  50. private class Enumerator : IEnumerator {
  51. private CodeParameterDeclarationExpressionCollection collection;
  52. private int currentIndex = -1;
  53. internal Enumerator (CodeParameterDeclarationExpressionCollection collection)
  54. {
  55. this.collection = collection;
  56. }
  57. public object Current {
  58. get {
  59. if (currentIndex == collection.Count)
  60. throw new InvalidOperationException ();
  61. return collection [currentIndex];
  62. }
  63. }
  64. public bool MoveNext ()
  65. {
  66. if (currentIndex > collection.Count)
  67. throw new InvalidOperationException ();
  68. return ++currentIndex < collection.Count;
  69. }
  70. public void Reset ()
  71. {
  72. currentIndex = -1;
  73. }
  74. }
  75. public IEnumerator GetEnumerator ()
  76. {
  77. return new CodeParameterDeclarationExpressionCollection.Enumerator (this);
  78. }
  79. //
  80. // IList method implementations
  81. //
  82. public int Add (object value)
  83. {
  84. return parameterDeclExprs.Add (value);
  85. }
  86. public bool Contains (Object value)
  87. {
  88. return parameterDeclExprs.Contains (value);
  89. }
  90. public int IndexOf (Object value)
  91. {
  92. return parameterDeclExprs.IndexOf (value);
  93. }
  94. public void Insert (int index, Object value)
  95. {
  96. parameterDeclExprs [index] = value;
  97. }
  98. public object this[int index] {
  99. get {
  100. return parameterDeclExprs [index];
  101. }
  102. set {
  103. parameterDeclExprs [index] = value;
  104. }
  105. }
  106. public void Remove (object value)
  107. {
  108. parameterDeclExprs.Remove (value);
  109. }
  110. public void RemoveAt (int index)
  111. {
  112. parameterDeclExprs.RemoveAt (index);
  113. }
  114. //
  115. // ICollection method implementations
  116. //
  117. public void CopyTo (Array array, int index)
  118. {
  119. parameterDeclExprs.CopyTo (array, index);
  120. }
  121. public object SyncRoot {
  122. get {
  123. return parameterDeclExprs.SyncRoot;
  124. }
  125. }
  126. public bool IsReadOnly {
  127. get {
  128. return false;
  129. }
  130. }
  131. public bool IsSynchronized {
  132. get {
  133. return parameterDeclExprs.IsSynchronized;
  134. }
  135. }
  136. }
  137. }