SchemaImporterExtensionElementCollection.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //------------------------------------------------------------------------------
  2. // <copyright file="SchemaImporterExtensionElementCollection.cs" company="Microsoft Corporation">
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. // </copyright>
  5. // <owner current="true" primary="true">Microsoft</owner>
  6. //------------------------------------------------------------------------------
  7. #if CONFIGURATION_DEP
  8. namespace System.Xml.Serialization.Configuration
  9. {
  10. using System;
  11. using System.Configuration;
  12. using System.Security.Permissions;
  13. [ConfigurationCollection(typeof(SchemaImporterExtensionElement))]
  14. public sealed class SchemaImporterExtensionElementCollection : ConfigurationElementCollection
  15. {
  16. public SchemaImporterExtensionElementCollection()
  17. {
  18. }
  19. public SchemaImporterExtensionElement this[int index]
  20. {
  21. get
  22. {
  23. return (SchemaImporterExtensionElement)BaseGet(index);
  24. }
  25. set
  26. {
  27. if (BaseGet(index) != null)
  28. {
  29. BaseRemoveAt(index);
  30. }
  31. BaseAdd(index,value);
  32. }
  33. }
  34. public new SchemaImporterExtensionElement this[string name]
  35. {
  36. get
  37. {
  38. return (SchemaImporterExtensionElement)BaseGet(name);
  39. }
  40. set
  41. {
  42. if (BaseGet(name) != null)
  43. {
  44. BaseRemove(name);
  45. }
  46. BaseAdd(value);
  47. }
  48. }
  49. public void Add(SchemaImporterExtensionElement element)
  50. {
  51. BaseAdd(element);
  52. }
  53. public void Clear()
  54. {
  55. BaseClear();
  56. }
  57. protected override ConfigurationElement CreateNewElement()
  58. {
  59. return new SchemaImporterExtensionElement();
  60. }
  61. protected override Object GetElementKey(ConfigurationElement element)
  62. {
  63. return ((SchemaImporterExtensionElement)element).Key;
  64. }
  65. public int IndexOf(SchemaImporterExtensionElement element)
  66. {
  67. return BaseIndexOf(element);
  68. }
  69. public void Remove(SchemaImporterExtensionElement element)
  70. {
  71. BaseRemove(element.Key);
  72. }
  73. public void Remove(string name)
  74. {
  75. BaseRemove(name);
  76. }
  77. public void RemoveAt(int index)
  78. {
  79. BaseRemoveAt(index);
  80. }
  81. }
  82. }
  83. #endif