5 // John Barnette (jbarn@httcb.net)
6 // Sean MacIsaac (macisaac@ximian.com)
7 // Ben Maurer (bmaurer@users.sourceforge.net)
10 // Copyright (C) 2001 John Barnette
11 // (C) Ximian, Inc. http://www.ximian.com
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 namespace System
.Collections
.Specialized
{
38 public class StringCollection
: IList
{
39 ArrayList data
= new ArrayList ();
41 public string this [int index
] {
42 get { return (string)data [index]; }
43 set { data [index] = value; }
47 get { return data.Count; }
50 bool IList
.IsReadOnly
{
54 bool IList
.IsFixedSize
{
59 public int Add (string value) {
60 return data
.Add (value);
63 public void AddRange (string [] value) {
65 throw new ArgumentNullException ("value");
67 data
.AddRange (value);
70 public void Clear () {
74 public bool Contains (string value) {
75 return data
.Contains (value);
78 public void CopyTo (string [] array
, int index
) {
79 data
.CopyTo (array
, index
);
82 public StringEnumerator
GetEnumerator () {
83 return new StringEnumerator (this);
86 public int IndexOf (string value) {
87 return data
.IndexOf (value);
90 public void Insert(int index
, string value) {
91 data
.Insert (index
, value);
94 public bool IsReadOnly
{
98 public bool IsSynchronized
{
102 public void Remove (string value) {
106 public void RemoveAt (int index
) {
107 data
.RemoveAt (index
);
110 public object SyncRoot
{
114 object IList
.this [int index
] {
115 get { return this [index]; }
116 set { this [index] = (string)value; }
119 int IList
.Add (object value) {
120 return Add ((string)value);
123 bool IList
.Contains (object value) {
124 return Contains ((string) value);
127 int IList
.IndexOf (object value) {
128 return IndexOf ((string)value);
131 void IList
.Insert (int index
, object value) {
132 Insert (index
, (string)value);
135 void IList
.Remove (object value) {
136 Remove ((string)value);
139 void ICollection
.CopyTo (Array array
, int index
) {
140 data
.CopyTo (array
, index
);
143 IEnumerator IEnumerable
.GetEnumerator () {
144 return data
.GetEnumerator ();