ImportCollection.cs 1.6 KB

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