FieldNameLookup.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // System.Data.Common.FieldNameLookup.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2002
  8. //
  9. using System.Collections;
  10. using System.Data;
  11. namespace System.Data.Common {
  12. internal sealed class FieldNameLookup : ICollection, IEnumerable
  13. {
  14. #region Fields
  15. ArrayList list;
  16. #endregion
  17. #region Constructors
  18. public FieldNameLookup ()
  19. {
  20. list = new ArrayList ();
  21. }
  22. public FieldNameLookup (DataTable schemaTable)
  23. : this ()
  24. {
  25. foreach (DataRow row in schemaTable.Rows)
  26. list.Add ((string) row["ColumnName"]);
  27. }
  28. #endregion
  29. #region Properties
  30. public int Count {
  31. get { return list.Count; }
  32. }
  33. public bool IsFixedSize {
  34. get { return false; }
  35. }
  36. public bool IsReadOnly {
  37. get { return false; }
  38. }
  39. public bool IsSynchronized {
  40. get { return list.IsSynchronized; }
  41. }
  42. public string this [int index] {
  43. get { return (string) list[index]; }
  44. set { list[index] = value; }
  45. }
  46. public object SyncRoot {
  47. get { return list.SyncRoot; }
  48. }
  49. #endregion
  50. #region Methods
  51. public int Add (object value)
  52. {
  53. return list.Add (value);
  54. }
  55. public void Clear ()
  56. {
  57. list.Clear ();
  58. }
  59. public bool Contains (object value)
  60. {
  61. return list.Contains (value);
  62. }
  63. public void CopyTo (Array array, int index)
  64. {
  65. list.CopyTo (array, index);
  66. }
  67. IEnumerator IEnumerable.GetEnumerator ()
  68. {
  69. return list.GetEnumerator ();
  70. }
  71. public int IndexOf (object value)
  72. {
  73. return list.IndexOf (value);
  74. }
  75. public void Insert (int index, object value)
  76. {
  77. list.Insert (index, value);
  78. }
  79. public void Remove (object value)
  80. {
  81. list.Remove (value);
  82. }
  83. public void RemoveAt (int index)
  84. {
  85. list.RemoveAt (index);
  86. }
  87. #endregion // Methods
  88. }
  89. }