- System.CodeDom review, ns more or less complete now
[mono.git] / mcs / class / System / System.CodeDom / CodeStatementCollection.cs
1 //
2 // System.CodeDom CodeStatementCollection Class implementation
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximian.com)
6 //   Daniel Stodden (stodden@in.tum.de)
7 //
8 // (C) 2001 Ximian, Inc.
9 //
10
11 using System.Runtime.InteropServices;
12 using System.Collections;
13
14 namespace System.CodeDom 
15 {
16         [Serializable]
17         [ClassInterface(ClassInterfaceType.AutoDispatch)]
18         [ComVisible(true)]
19         public class CodeStatementCollection
20                 : CollectionBase
21         {
22                 //
23                 // Constructors
24                 //
25                 public CodeStatementCollection()
26                 {
27                 }
28
29                 public CodeStatementCollection( CodeStatement[] value )
30                 {
31                         AddRange( value );
32                 }
33
34                 public CodeStatementCollection( CodeStatementCollection value )
35                 {
36                         AddRange( value );
37                 }
38
39                 //
40                 // Properties
41                 //
42                 public CodeStatement this[int index]
43                 {
44                         get {
45                                 return (CodeStatement)List[index];
46                         }
47                         set {
48                                 List[index] = value;
49                         }
50                 }
51
52                 //
53                 // Methods
54                 //
55                 public void Add (CodeStatement value)
56                 {
57                         List.Add( value );
58                 }
59
60                 public void AddRange (CodeStatement [] value )
61                 {
62                         foreach ( CodeStatement elem in value )
63                                 Add( elem );
64                 }
65                 
66                 public void AddRange (CodeStatementCollection value)
67                 {
68                         foreach ( CodeStatement elem in value )
69                                 Add( elem );
70                 }
71
72                 public bool Contains( CodeStatement value )
73                 {
74                         return List.Contains( value );
75                 }
76                 
77                 public void CopyTo( CodeStatement[] array, int index )
78                 {
79                         List.CopyTo( array, index );
80                 }
81
82                 public int IndexOf( CodeStatement value )
83                 {
84                         return List.IndexOf( value );
85                 }
86
87                 public void Insert( int index, CodeStatement value )
88                 {
89                         List.Insert( index, value );
90                 }
91
92                 public void Remove( CodeStatement value )
93                 {
94                         int index = IndexOf( value );
95                         if ( index < 0 )
96                                 throw( new ArgumentException( "The specified object is not found in the collection" ) );
97                         RemoveAt( index );
98                 }
99         }
100 }