BaseChannelObjectWithProperties.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //
  2. // System.Runtime.Remoting.Channels.BaseChannelObjectWithProperties.cs
  3. //
  4. // Author: Rodrigo Moya ([email protected])
  5. // Duncan Mak ([email protected])
  6. //
  7. // 2002 (C) Copyright, Ximian, Inc.
  8. //
  9. using System.Collections;
  10. namespace System.Runtime.Remoting.Channels
  11. {
  12. public abstract class BaseChannelObjectWithProperties :
  13. IDictionary, ICollection, IEnumerable
  14. {
  15. Hashtable table;
  16. public BaseChannelObjectWithProperties ()
  17. {
  18. table = new Hashtable ();
  19. }
  20. public virtual int Count
  21. {
  22. get { return table.Count; }
  23. }
  24. public virtual bool IsFixedSize
  25. {
  26. get { return true; }
  27. }
  28. public virtual bool IsReadOnly
  29. {
  30. get { return false; }
  31. }
  32. public virtual bool IsSynchronized
  33. {
  34. get { return false; }
  35. }
  36. //
  37. // This is explicitly not implemented.
  38. //
  39. public virtual object this [object key]
  40. {
  41. get { throw new NotImplementedException (); }
  42. set { throw new NotImplementedException (); }
  43. }
  44. public virtual ICollection Keys
  45. {
  46. get { return table.Keys; }
  47. }
  48. public virtual IDictionary Properties
  49. {
  50. get { return this as IDictionary; }
  51. }
  52. public virtual object SyncRoot
  53. {
  54. get { return this; }
  55. }
  56. public virtual ICollection Values
  57. {
  58. get { return table.Values; }
  59. }
  60. public virtual void Add (object key, object value)
  61. {
  62. // .NET says this method must not implemented
  63. throw new NotSupportedException ();
  64. }
  65. public virtual void Clear ()
  66. {
  67. // .NET says this method must not implemented
  68. throw new NotSupportedException ();
  69. }
  70. public virtual bool Contains (object key)
  71. {
  72. return table.Contains (key);
  73. }
  74. public virtual void CopyTo (Array array, int index)
  75. {
  76. // .NET says this method must not implemented
  77. throw new NotSupportedException ();
  78. }
  79. public virtual IDictionaryEnumerator GetEnumerator ()
  80. {
  81. return table.GetEnumerator ();
  82. }
  83. IEnumerator IEnumerable.GetEnumerator ()
  84. {
  85. return table.GetEnumerator ();
  86. }
  87. public virtual void Remove (object key)
  88. {
  89. // .NET says this method must not implemented
  90. throw new NotSupportedException ();
  91. }
  92. }
  93. }