2 * Firebird ADO.NET Data provider for .NET and Mono
4 * The contents of this file are subject to the Initial
5 * Developer's Public License Version 1.0 (the "License");
6 * you may not use this file except in compliance with the
7 * License. You may obtain a copy of the License at
8 * http://www.firebirdsql.org/index.php?op=doc&id=idpl
10 * Software distributed under the License is distributed on
11 * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
12 * express or implied. See the License for the specific
13 * language governing rights and limitations under the License.
15 * Copyright (c) 2002, 2005 Carlos Guzman Alvarez
16 * All Rights Reserved.
22 using System.Collections;
24 namespace System.Collections.Specialized
26 public class StringCollection : CollectionBase
30 public string this[int index]
32 get { return ((string)base.List[index]); }
33 set { base.List[index] = value; }
40 public int Add(string value)
42 return (base.List.Add(value));
45 public void CopyTo(string[] array, int index)
49 throw new ArgumentNullException("array is null.");
53 throw new ArgumentOutOfRangeException("index is less than zero.");
57 throw new ArgumentException("array is multidimensional.");
59 if (index >= array.Length)
61 throw new ArgumentException("index is equal to or greater than the length of array.");
63 if ((array.Length - index) < this.List.Count)
65 throw new ArgumentException("The number of elements in the source StringCollection is greater than the available space from index to the end of the destination array.");
68 foreach (string value in this.List)
70 if (index < array.Length)
72 array[index++] = value;
77 public int IndexOf(string value)
79 return (base.List.IndexOf(value));
82 public void Insert(int index, string value)
84 base.List.Insert(index, value);
87 public void Remove(string value)
89 base.List.Remove(value);
92 public bool Contains(string value)
94 // If value is not of type String, this will return false.
95 return (base.List.Contains(value));
100 #region Protected MEthods
102 protected override void OnValidate(Object value)
104 if (value.GetType() != Type.GetType("System.String"))
106 throw new ArgumentException("value must be of type String.", "value");