CodeCatchClauseCollection.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // System.CodeDom CodeCatchClauseCollection Class implementation
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. //
  7. // (C) 2001 Ximian, Inc.
  8. //
  9. using System.Runtime.InteropServices;
  10. using System.Collections;
  11. namespace System.CodeDom
  12. {
  13. [Serializable]
  14. [ClassInterface(ClassInterfaceType.AutoDispatch)]
  15. [ComVisible(true)]
  16. public class CodeCatchClauseCollection
  17. : CollectionBase
  18. {
  19. //
  20. // Constructors
  21. //
  22. public CodeCatchClauseCollection()
  23. {
  24. }
  25. public CodeCatchClauseCollection( CodeCatchClause[] value )
  26. {
  27. AddRange( value );
  28. }
  29. public CodeCatchClauseCollection( CodeCatchClauseCollection value )
  30. {
  31. AddRange( value );
  32. }
  33. //
  34. // Properties
  35. //
  36. public CodeCatchClause this[int index] {
  37. get {
  38. return (CodeCatchClause)List[index];
  39. }
  40. set {
  41. List[index] = value;
  42. }
  43. }
  44. //
  45. // Methods
  46. //
  47. public void Add (CodeCatchClause value)
  48. {
  49. List.Add (value);
  50. }
  51. public void AddRange (CodeCatchClause [] value)
  52. {
  53. foreach (CodeCatchClause ca in value)
  54. Add (ca);
  55. }
  56. public void AddRange (CodeCatchClauseCollection value )
  57. {
  58. foreach (CodeCatchClause ca in value)
  59. Add (ca);
  60. }
  61. public bool Contains( CodeCatchClause value )
  62. {
  63. return List.Contains( value );
  64. }
  65. public void CopyTo( CodeCatchClause[] array, int index )
  66. {
  67. List.CopyTo( array, index );
  68. }
  69. public int IndexOf( CodeCatchClause value )
  70. {
  71. return List.IndexOf( value );
  72. }
  73. public void Insert( int index, CodeCatchClause value )
  74. {
  75. List.Insert( index, value );
  76. }
  77. public void Remove( CodeCatchClause value )
  78. {
  79. int index = IndexOf( value );
  80. if ( index < 0 )
  81. throw( new ArgumentException( "The specified object is not found in the collection" ) );
  82. RemoveAt( index );
  83. }
  84. }
  85. }