BindingCollection.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // System.Web.Services.Description.BindingCollection.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2002
  8. //
  9. namespace System.Web.Services.Description {
  10. public sealed class BindingCollection : ServiceDescriptionBaseCollection {
  11. #region Fields
  12. ServiceDescription serviceDescription;
  13. #endregion // Fields
  14. #region Constructors
  15. internal BindingCollection (ServiceDescription serviceDescription)
  16. : base (serviceDescription)
  17. {
  18. }
  19. #endregion // Constructors
  20. #region Properties
  21. public Binding this [int index] {
  22. get {
  23. if (index < 0 || index > Count)
  24. throw new ArgumentOutOfRangeException ();
  25. return (Binding) List[index];
  26. }
  27. set { List [index] = value; }
  28. }
  29. public Binding this [string name] {
  30. get { return this[IndexOf ((Binding) Table[name])]; }
  31. }
  32. #endregion // Properties
  33. #region Methods
  34. public int Add (Binding binding)
  35. {
  36. Insert (Count, binding);
  37. return (Count - 1);
  38. }
  39. public bool Contains (Binding binding)
  40. {
  41. return List.Contains (binding);
  42. }
  43. public void CopyTo (Binding[] array, int index)
  44. {
  45. List.CopyTo (array, index);
  46. }
  47. protected override string GetKey (object value)
  48. {
  49. if (!(value is Binding))
  50. throw new InvalidCastException ();
  51. return ((Binding) value).Name;
  52. }
  53. public int IndexOf (Binding binding)
  54. {
  55. return List.IndexOf (binding);
  56. }
  57. public void Insert (int index, Binding binding)
  58. {
  59. List.Insert (index, binding);
  60. }
  61. public void Remove (Binding binding)
  62. {
  63. List.Remove (binding);
  64. }
  65. protected override void SetParent (object value, object parent)
  66. {
  67. ((Binding) value).SetParent ((ServiceDescription) parent);
  68. }
  69. #endregion // Methods
  70. }
  71. }