2003-07-09 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
[mono.git] / mcs / class / System / System.Collections.Specialized / StringCollection.cs
1 //
2 // StringCollection.cs
3 //
4 // Authors:
5 //      John Barnette (jbarn@httcb.net)
6 //      Sean MacIsaac (macisaac@ximian.com)
7 //      Ben Maurer (bmaurer@users.sourceforge.net)
8 //
9 // (C) 2003 Ben Maurer
10 // Copyright (C) 2001 John Barnette
11 // (C) Ximian, Inc.  http://www.ximian.com
12
13
14 namespace System.Collections.Specialized {
15         
16         [Serializable]
17         public class StringCollection : IList {
18                 ArrayList strings = new ArrayList ();
19         
20                 public string this [int index] {
21                         get { return (string)strings [index]; }
22                         set { strings [index] = value;  }
23                 }
24                 
25                 public int Count {
26                         get { return strings.Count; }
27                 }
28
29                 bool IList.IsReadOnly {
30                         get { return false; }
31                 }
32                 
33                 bool IList.IsFixedSize {
34                         get { return false; }
35                 }
36                 
37                 
38                 public int Add (string value) {
39                         return strings.Add (value);
40                 }
41                 
42                 public void AddRange (string [] value) {
43                         if (value == null)
44                                 throw new ArgumentNullException ("value");
45
46                         strings.AddRange (value);
47                 }
48                 
49                 public void Clear () {
50                         strings.Clear ();
51                 }
52                 
53                 public bool Contains (string value) {
54                         return strings.Contains (value);
55                 }
56                 
57                 public void CopyTo (string [] array, int index) {
58                         strings.CopyTo (array, index);
59                 }
60                 
61                 public StringEnumerator GetEnumerator () {
62                         return new StringEnumerator (this);
63                 }
64                 
65                 public int IndexOf (string value) {
66                         return strings.IndexOf (value);
67                 }
68                 
69                 public void Insert(int index, string value) {
70                         strings.Insert (index, value);
71                 }
72                 
73                 public bool IsReadOnly {
74                         get { return false; }
75                 }
76                 
77                 public bool IsSynchronized {
78                         get { return false; }
79                 }
80                 
81                 public void Remove (string value) {
82                         strings.Remove (value);
83                 }
84                 
85                 public void RemoveAt (int index) {
86                         strings.RemoveAt (index);
87                 }
88                 
89                 public object SyncRoot {
90                         get { return this; }
91                 }
92                 
93                 object IList.this [int index] {
94                         get { return this [index]; }
95                         set { this [index] = (string)value; }
96                 }
97                 
98                 int IList.Add (object value) {
99                         return Add ((string)value);
100                 }
101                 
102                 bool IList.Contains (object value) {
103                         return Contains ((string) value);
104                 }
105
106                 int IList.IndexOf (object value) {
107                         return IndexOf ((string)value);
108                 }
109                 
110                 void IList.Insert (int index, object value) {
111                         Insert (index, (string)value);
112                 }
113                 
114                 void IList.Remove (object value) {
115                         Remove ((string)value);
116                 }
117                 
118                 void ICollection.CopyTo (Array array, int index) {
119                         strings.CopyTo (array, index);
120                 }
121                 
122                 IEnumerator IEnumerable.GetEnumerator () {
123                         return strings.GetEnumerator ();
124                 }
125         }
126 }