OperationFaultCollection.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // System.Web.Services.Description.OperationFaultCollection.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 OperationFaultCollection : ServiceDescriptionBaseCollection {
  11. #region Fields
  12. Operation operation;
  13. #endregion // Fields
  14. #region Constructors
  15. internal OperationFaultCollection (Operation operation)
  16. {
  17. this.operation = operation;
  18. }
  19. #endregion // Constructors
  20. #region Properties
  21. public OperationFault this [int index] {
  22. get {
  23. if (index < 0 || index > Count)
  24. throw new ArgumentOutOfRangeException ();
  25. return (OperationFault) List[index];
  26. }
  27. [MonoTODO]
  28. set { throw new NotImplementedException (); }
  29. }
  30. public OperationFault this [string name] {
  31. get { return this[IndexOf ((OperationFault) Table[name])]; }
  32. }
  33. #endregion // Properties
  34. #region Methods
  35. public int Add (OperationFault operationFaultMessage)
  36. {
  37. Insert (Count, operationFaultMessage);
  38. return (Count - 1);
  39. }
  40. public bool Contains (OperationFault operationFaultMessage)
  41. {
  42. return List.Contains (operationFaultMessage);
  43. }
  44. public void CopyTo (OperationFault[] array, int index)
  45. {
  46. List.CopyTo (array, index);
  47. }
  48. protected override string GetKey (object value)
  49. {
  50. if (!(value is OperationFault))
  51. throw new InvalidCastException ();
  52. return ((OperationFault) value).Name;
  53. }
  54. public int IndexOf (OperationFault operationFaultMessage)
  55. {
  56. return List.IndexOf (operationFaultMessage);
  57. }
  58. public void Insert (int index, OperationFault operationFaultMessage)
  59. {
  60. SetParent (operationFaultMessage, operation);
  61. Table [GetKey (operationFaultMessage)] = operationFaultMessage;
  62. List.Insert (index, operation);
  63. }
  64. public void Remove (OperationFault operationFaultMessage)
  65. {
  66. Table.Remove (GetKey (operationFaultMessage));
  67. List.Remove (operationFaultMessage);
  68. }
  69. protected override void SetParent (object value, object parent)
  70. {
  71. ((OperationFault) value).SetParent ((Operation) parent);
  72. }
  73. #endregion // Methods
  74. }
  75. }