Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
2.1 KiB

  1. using System;
  2. using System.Collections;
  3. using System.Diagnostics;
  4. using System.Xml.Serialization;
  5. namespace Microsoft.Uddi.Business
  6. {
  7. public class Phone : UddiCore
  8. {
  9. private string text;
  10. private string useType;
  11. public Phone() : this( "", "" )
  12. {}
  13. public Phone(string phone, string useType)
  14. {
  15. Text = phone;
  16. UseType = useType;
  17. }
  18. [XmlText]
  19. public string Text
  20. {
  21. get { return text; }
  22. set { text = value; }
  23. }
  24. [XmlAttribute("useType")]
  25. public string UseType
  26. {
  27. get { return useType; }
  28. set { useType = value; }
  29. }
  30. }
  31. public class PhoneCollection : CollectionBase
  32. {
  33. public Phone this[int index]
  34. {
  35. get { return ( Phone )List[ index]; }
  36. set { List[ index ] = value; }
  37. }
  38. public int Add( Phone phoneObject )
  39. {
  40. return List.Add( phoneObject );
  41. }
  42. public int Add( string phone )
  43. {
  44. return( Add( phone, null ) );
  45. }
  46. public int Add( string phone, string useType )
  47. {
  48. return List.Add( new Phone( phone, useType ) );
  49. }
  50. public void Insert( int index, Phone value )
  51. {
  52. List.Insert( index, value );
  53. }
  54. public int IndexOf( Phone value )
  55. {
  56. return List.IndexOf( value );
  57. }
  58. public bool Contains( Phone value )
  59. {
  60. return List.Contains( value );
  61. }
  62. public void Remove( Phone value )
  63. {
  64. List.Remove( value );
  65. }
  66. public void CopyTo( Phone[] array, int index )
  67. {
  68. List.CopyTo( array, index );
  69. }
  70. public new PhoneEnumerator GetEnumerator()
  71. {
  72. return new PhoneEnumerator( List.GetEnumerator() );
  73. }
  74. }
  75. public sealed class PhoneEnumerator : IEnumerator
  76. {
  77. private IEnumerator enumerator;
  78. public PhoneEnumerator( IEnumerator enumerator )
  79. {
  80. this.enumerator = enumerator;
  81. }
  82. public Phone Current
  83. {
  84. get { return ( Phone ) enumerator.Current; }
  85. }
  86. object IEnumerator.Current
  87. {
  88. get{ return enumerator.Current; }
  89. }
  90. public bool MoveNext()
  91. {
  92. return enumerator.MoveNext();
  93. }
  94. public void Reset()
  95. {
  96. enumerator.Reset();
  97. }
  98. }
  99. }