StringCollection.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // StringCollection.cs
  3. //
  4. // Authors:
  5. // John Barnette ([email protected])
  6. // Sean MacIsaac ([email protected])
  7. // Ben Maurer ([email protected])
  8. //
  9. // (C) 2003 Ben Maurer
  10. // Copyright (C) 2001 John Barnette
  11. // (C) Ximian, Inc. http://www.ximian.com
  12. namespace System.Collections.Specialized {
  13. [Serializable]
  14. public class StringCollection : IList {
  15. ArrayList strings = new ArrayList ();
  16. public string this [int index] {
  17. get { return (string)strings [index]; }
  18. set { strings [index] = value; }
  19. }
  20. public int Count {
  21. get { return strings.Count; }
  22. }
  23. bool IList.IsReadOnly {
  24. get { return false; }
  25. }
  26. bool IList.IsFixedSize {
  27. get { return false; }
  28. }
  29. public int Add (string value) {
  30. return strings.Add (value);
  31. }
  32. public void AddRange (string [] value) {
  33. if (value == null)
  34. throw new ArgumentNullException ("value");
  35. strings.AddRange (value);
  36. }
  37. public void Clear () {
  38. strings.Clear ();
  39. }
  40. public bool Contains (string value) {
  41. return strings.Contains (value);
  42. }
  43. public void CopyTo (string [] array, int index) {
  44. strings.CopyTo (array, index);
  45. }
  46. public StringEnumerator GetEnumerator () {
  47. return new StringEnumerator (this);
  48. }
  49. public int IndexOf (string value) {
  50. return strings.IndexOf (value);
  51. }
  52. public void Insert(int index, string value) {
  53. strings.Insert (index, value);
  54. }
  55. public bool IsReadOnly {
  56. get { return false; }
  57. }
  58. public bool IsSynchronized {
  59. get { return false; }
  60. }
  61. public void Remove (string value) {
  62. strings.Remove (value);
  63. }
  64. public void RemoveAt (int index) {
  65. strings.RemoveAt (index);
  66. }
  67. public object SyncRoot {
  68. get { return this; }
  69. }
  70. object IList.this [int index] {
  71. get { return this [index]; }
  72. set { this [index] = (string)value; }
  73. }
  74. int IList.Add (object value) {
  75. return Add ((string)value);
  76. }
  77. bool IList.Contains (object value) {
  78. return Contains ((string) value);
  79. }
  80. int IList.IndexOf (object value) {
  81. return IndexOf ((string)value);
  82. }
  83. void IList.Insert (int index, object value) {
  84. Insert (index, (string)value);
  85. }
  86. void IList.Remove (object value) {
  87. Remove ((string)value);
  88. }
  89. void ICollection.CopyTo (Array array, int index) {
  90. strings.CopyTo (array, index);
  91. }
  92. IEnumerator IEnumerable.GetEnumerator () {
  93. return strings.GetEnumerator ();
  94. }
  95. }
  96. }