OperationCollection.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // System.Web.Services.Description.OperationCollection.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 OperationCollection : ServiceDescriptionBaseCollection {
  11. #region Fields
  12. PortType portType;
  13. #endregion // Fields
  14. #region Constructors
  15. internal OperationCollection (PortType portType)
  16. {
  17. this.portType = portType;
  18. }
  19. #endregion // Constructors
  20. #region Properties
  21. public Operation this [int index] {
  22. get {
  23. if (index < 0 || index > Count)
  24. throw new ArgumentOutOfRangeException ();
  25. return (Operation) List[index];
  26. }
  27. set { List[index] = value; }
  28. }
  29. #endregion // Properties
  30. #region Methods
  31. public int Add (Operation operation)
  32. {
  33. Insert (Count, operation);
  34. return (Count - 1);
  35. }
  36. public bool Contains (Operation operation)
  37. {
  38. return List.Contains (operation);
  39. }
  40. public void CopyTo (Operation[] array, int index)
  41. {
  42. List.CopyTo (array, index);
  43. }
  44. public int IndexOf (Operation operation)
  45. {
  46. return List.IndexOf (operation);
  47. }
  48. public void Insert (int index, Operation operation)
  49. {
  50. SetParent (operation, portType);
  51. List.Insert (index, operation);
  52. }
  53. public void Remove (Operation operation)
  54. {
  55. List.Remove (operation);
  56. }
  57. protected override void SetParent (object value, object parent)
  58. {
  59. ((Operation) value).SetParent ((PortType) parent);
  60. }
  61. #endregion // Methods
  62. }
  63. }