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.

132 lines
2.6 KiB

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