Hi,

The attached patch fixes some API compatibity mismatches in
System.Collections.Generic and System.Collections.Specialized.

Let me know if it's ok to commit.

Gert
Index: System.Collections.Specialized/ChangeLog
===================================================================
--- System.Collections.Specialized/ChangeLog	(revision 65793)
+++ System.Collections.Specialized/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2006-09-30  Gert Driesen  <[EMAIL PROTECTED]>
+
+	* OrderedDictionary.cs: IsReadOnly, indexers, Keys and Values should
+	not be virtual.
+
 2006-04-04  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
 	* BitVector32.cs : oops those operators are for BitVector32.Section,
Index: System.Collections.Specialized/OrderedDictionary.cs
===================================================================
--- System.Collections.Specialized/OrderedDictionary.cs	(revision 65793)
+++ System.Collections.Specialized/OrderedDictionary.cs	(working copy)
@@ -150,14 +150,14 @@
 			}
 		}
 		
-		public virtual bool IsReadOnly
+		public bool IsReadOnly
 		{
 			get {
 				return readOnly;
 			}
 		}
 		
-		public virtual object this [object key]
+		public object this [object key]
 		{
 			get { return hash [key]; }
 			set {
@@ -172,7 +172,7 @@
 			}
 		}
 		
-		public virtual object this [int index]
+		public object this [int index]
 		{
 			get { return ((DictionaryEntry) list [index]).Value; }
 			set {
@@ -185,14 +185,14 @@
 			}
 		}
 		
-		public virtual ICollection Keys
+		public ICollection Keys
 		{
 			get {
 				return new OrderedCollection (list, true);
 			}
 		}
 		
-		public virtual ICollection Values
+		public ICollection Values
 		{
 			get {
 				return new OrderedCollection (list, false);
Index: System.Collections.Generic/SortedList.cs
===================================================================
--- System.Collections.Generic/SortedList.cs	(revision 65793)
+++ System.Collections.Generic/SortedList.cs	(working copy)
@@ -38,8 +38,8 @@
 using System.Globalization;
 using System.Runtime.InteropServices;
 
-namespace System.Collections.Generic {
-
+namespace System.Collections.Generic
+{
 	/// <summary>
 	///  Represents a collection of associated keys and values
 	///  that are sorted by the keys and are accessible by key
@@ -114,7 +114,7 @@
 
 		// ICollection
 
-		public virtual int Count {
+		public int Count {
 			get {
 				return inUse;
 			}
@@ -146,7 +146,7 @@
 			}
 		}
 
-		public virtual TValue this [TKey key] {
+		public TValue this [TKey key] {
 			get {
 				if (key == null)
 					throw new ArgumentNullException("key");
@@ -268,24 +268,14 @@
 		// Public instance methods.
 		//
 
-		// IDictionary<TKey, TValue>
-
-		void IDictionary<TKey,TValue>.Add (TKey key, TValue value)
+		public void Add (TKey key, TValue value)
 		{
 			if (key == null)
 				throw new ArgumentNullException ("key");
 
 			PutImpl (key, value, false);
 		}
-		
-		public virtual void Add (TKey key, TValue value)
-		{
-			if (key == null)
-				throw new ArgumentNullException ("key");
 
-			PutImpl (key, value, false);
-		}
-
 		public bool ContainsKey (TKey key)
 		{
 			if (key == null)
@@ -303,7 +293,7 @@
 			}
 		}
 
-		bool IDictionary<TKey,TValue>.Remove (TKey key)
+		public bool Remove (TKey key)
 		{
 			if (key == null)
 				throw new ArgumentNullException ("key");
@@ -317,20 +307,6 @@
 				return false;
 		}
 
-		public virtual bool Remove (TKey key)
-		{
-			if (key == null)
-				throw new ArgumentNullException ("key");
-
-			int i = IndexOfKey (key);
-			if (i >= 0) {
-				RemoveAt (i);
-				return true;
-			}
-			else
-				return false;
-		}
-
 		// ICollection<KeyValuePair<TKey, TValue>>
 
 		void ICollection<KeyValuePair<TKey, TValue>>.Clear () 
@@ -341,7 +317,7 @@
 			modificationCount++;
 		}
 
-		public virtual void Clear () 
+		public void Clear () 
 		{
 			defaultCapacity = INITIAL_SIZE;
 			this.table = new KeyValuePair<TKey, TValue> [defaultCapacity];

Property changes on: System.Collections.Generic/SortedList.cs
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: System.Collections.Generic/LinkedList.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Collections.Generic/ChangeLog
===================================================================
--- System.Collections.Generic/ChangeLog	(revision 65793)
+++ System.Collections.Generic/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2006-09-30  Gert Driesen  <[EMAIL PROTECTED]>
+
+	* SortedList.cs: Count property, indexer and Clear method should not 
+	be virtual. Removed unnecessary explicit interface implementation of
+	 Add (TKey, TValue) and Remove (TKey, TValue).
+	* Queue.cs: Marked Enumerator as Serializable.
+	* Stack.cs: Marked Stack <T> and Enumerator as serializable.
+
 2006-04-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
 	* SortedDictionary.cs : new file. The original code is mostly
Index: System.Collections.Generic/Queue.cs
===================================================================
--- System.Collections.Generic/Queue.cs	(revision 65793)
+++ System.Collections.Generic/Queue.cs	(working copy)
@@ -245,6 +245,7 @@
 			return GetEnumerator ();
 		}
 		
+		[Serializable]
 		public struct Enumerator : IEnumerator <T>, IEnumerator, IDisposable {
 			const int NOT_STARTED = -2;
 			

Property changes on: System.Collections.Generic/Queue.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Collections.Generic/Stack.cs
===================================================================
--- System.Collections.Generic/Stack.cs	(revision 65793)
+++ System.Collections.Generic/Stack.cs	(working copy)
@@ -38,6 +38,7 @@
 namespace System.Collections.Generic
 {
 	[ComVisible (false)]
+	[Serializable]
 	public class Stack <T> : IEnumerable <T>, ICollection, IEnumerable {
 		
 		T [] data;
@@ -184,6 +185,7 @@
 			return GetEnumerator ();
 		}
 		
+		[Serializable]
 		public struct Enumerator : IEnumerator <T>, IEnumerator, IDisposable {
 			const int NOT_STARTED = -2;
 			

Property changes on: System.Collections.Generic/Stack.cs
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: System.Collections.Generic/LinkedListNode.cs
___________________________________________________________________
Name: svn:eol-style
   + native

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to