ExtendedPropertyCollection.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // System.Data.ObjectSpaces.Schema.ExtendedPropertyCollection.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2003
  8. //
  9. #if NET_1_2
  10. using System.Collections;
  11. using System.Xml;
  12. namespace System.Data.ObjectSpaces.Schema {
  13. public class ExtendedPropertyCollection : CollectionBase
  14. {
  15. #region Fields
  16. ArrayList qnames;
  17. #endregion
  18. #region Constructors
  19. public ExtendedPropertyCollection ()
  20. {
  21. qnames = new ArrayList();
  22. }
  23. public ExtendedPropertyCollection (ExtendedProperty[] value)
  24. : this ()
  25. {
  26. AddRange (value);
  27. }
  28. public ExtendedPropertyCollection (ExtendedPropertyCollection value)
  29. : this ()
  30. {
  31. AddRange (value);
  32. }
  33. #endregion // Constructors
  34. #region Properties
  35. public ExtendedProperty this [int obj] {
  36. get { return (ExtendedProperty) List [obj]; }
  37. set {
  38. List [obj] = value;
  39. qnames [obj] = value.QualifiedName;
  40. }
  41. }
  42. [MonoTODO]
  43. public ExtendedProperty this [XmlQualifiedName type] {
  44. get { return (ExtendedProperty) List [qnames.IndexOf (type)]; }
  45. set { List [qnames.IndexOf (type)] = value; }
  46. }
  47. #endregion // Properties
  48. #region Methods
  49. public void Add (ExtendedProperty value)
  50. {
  51. Insert (Count, value);
  52. }
  53. public void AddRange (ExtendedProperty[] value)
  54. {
  55. foreach (ExtendedProperty p in value)
  56. Add (p);
  57. }
  58. public void AddRange (ExtendedPropertyCollection value)
  59. {
  60. foreach (ExtendedProperty p in value)
  61. Add (p);
  62. }
  63. public bool Contains (ExtendedProperty value)
  64. {
  65. return List.Contains (value);
  66. }
  67. public void CopyTo (ExtendedProperty[] array, int index)
  68. {
  69. List.CopyTo (array, index);
  70. }
  71. public int IndexOf (ExtendedProperty value)
  72. {
  73. return List.IndexOf (value);
  74. }
  75. [MonoTODO]
  76. public void Insert (int index, ExtendedProperty value)
  77. {
  78. List.Insert (index, value);
  79. qnames [index] = value.QualifiedName;
  80. }
  81. [MonoTODO]
  82. protected override void OnInsert (int index, object value)
  83. {
  84. }
  85. [MonoTODO]
  86. protected override void OnRemove (int index, object value)
  87. {
  88. }
  89. [MonoTODO]
  90. public void Remove (ExtendedProperty value)
  91. {
  92. int index = IndexOf (value);
  93. List.Remove (value);
  94. qnames.RemoveAt (index);
  95. }
  96. #endregion // Methods
  97. }
  98. }
  99. #endif // NET_1_2