CrossAppDomainChannel.cs: Make _ContextID an object that fixes bug #422491.
[mono.git] / mcs / class / corlib / System.Runtime.Remoting.Channels / BaseChannelObjectWithProperties.cs
index 1bc48f3c52de22e5269bd4f3bdceca84de6dc616..0a8775e6f9d9a8f098c7486adcc072856e298ce7 100644 (file)
@@ -2,44 +2,81 @@
 // System.Runtime.Remoting.Channels.BaseChannelObjectWithProperties.cs
 //
 // Author: Rodrigo Moya (rodrigo@ximian.com)
+//        Duncan Mak (duncan@ximian.com)
 //
 // 2002 (C) Copyright, Ximian, Inc.
 //
 
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
 using System.Collections;
 
 namespace System.Runtime.Remoting.Channels
 {
 
+#if NET_2_0
+       [System.Runtime.InteropServices.ComVisible (true)]
+#endif
        public abstract class BaseChannelObjectWithProperties :
                IDictionary, ICollection, IEnumerable
        {
-               [MonoTODO]
-               public BaseChannelObjectWithProperties ()
+               Hashtable table;
+               
+#if NET_2_0
+               protected
+#else
+               public
+#endif
+               BaseChannelObjectWithProperties ()
                {
+                       table = new Hashtable ();
                }
 
-               public virtual int Count
+               public virtual int Count
                {
-                       get { throw new NotImplementedException (); }
+                       get { return table.Count; }
                }
 
                public virtual bool IsFixedSize
                {
-                       get { throw new NotImplementedException (); }
+                       get { return true; }
                }
                
                public virtual bool IsReadOnly
                {
-                       get { throw new NotImplementedException (); }
+                       get { return false; }
                }
 
                public virtual bool IsSynchronized
                {
-                       get { throw new NotImplementedException (); }
+                       get { return false; }
                }
 
-               public virtual object this[object key]
+               //
+               // This is explicitly not implemented.
+               //
+               public virtual object this [object key]
                {
                        get { throw new NotImplementedException (); }
                        set { throw new NotImplementedException (); }
@@ -47,25 +84,24 @@ namespace System.Runtime.Remoting.Channels
 
                public virtual ICollection Keys
                {
-                       get { throw new NotImplementedException (); }
+                       get { return table.Keys; }
                }
 
                public virtual IDictionary Properties
                {
-                       get { throw new NotImplementedException (); }
+                       get { return this as IDictionary; }
                }
 
                public virtual object SyncRoot
                {
-                       get { throw new NotImplementedException (); }
+                       get { return this; }
                }
 
                public virtual ICollection Values
                {
-                       get { throw new NotImplementedException (); }
+                       get { return table.Values; }
                }
 
-               [MonoTODO]
                public virtual void Add (object key, object value)
                {
                        // .NET says this method must not implemented
@@ -80,7 +116,7 @@ namespace System.Runtime.Remoting.Channels
 
                public virtual bool Contains (object key)
                {
-                       throw new NotImplementedException ();
+                       return table.Contains (key);
                }
 
                public virtual void CopyTo (Array array, int index)
@@ -91,12 +127,12 @@ namespace System.Runtime.Remoting.Channels
                
                public virtual IDictionaryEnumerator GetEnumerator ()
                {
-                       throw new NotImplementedException ();
+                       return table.GetEnumerator ();
                }
 
                IEnumerator IEnumerable.GetEnumerator ()
                {
-                       throw new NotImplementedException ();
+                       return table.GetEnumerator ();
                }
                
                public virtual void Remove (object key)