NamespaceElementCollection.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Configuration;
  5. using System.ServiceModel;
  6. using System.ServiceModel.Channels;
  7. using System.ServiceModel.Configuration;
  8. using System.ServiceModel.Description;
  9. using System.ServiceModel.Dispatcher;
  10. namespace System.ServiceModel.Routing.Configuration
  11. {
  12. [ConfigurationCollection (typeof(NamespaceElement))]
  13. public class NamespaceElementCollection : ConfigurationElementCollection
  14. {
  15. public void Add (NamespaceElement element)
  16. {
  17. BaseAdd (element);
  18. }
  19. public void Clear ()
  20. {
  21. BaseClear ();
  22. }
  23. protected override ConfigurationElement CreateNewElement ()
  24. {
  25. return new NamespaceElement ();
  26. }
  27. protected override object GetElementKey (ConfigurationElement element)
  28. {
  29. return ((NamespaceElement) element).Prefix;
  30. }
  31. public new NamespaceElement this [string name] {
  32. get {
  33. foreach (NamespaceElement ne in this)
  34. if (ne.Namespace == name)
  35. return ne;
  36. return null;
  37. }
  38. }
  39. public NamespaceElement this [int index] {
  40. get { return (NamespaceElement) BaseGet (index); }
  41. }
  42. public override bool IsReadOnly ()
  43. {
  44. return base.IsReadOnly ();
  45. }
  46. public void Remove (NamespaceElement element)
  47. {
  48. BaseRemove (element);
  49. }
  50. }
  51. }