Просмотр исходного кода

2003-03-05 Gonzalo Paniagua Javier <[email protected]>

	* Queue.cs: fixed bug #39046.

svn path=/trunk/mcs/; revision=12202
Gonzalo Paniagua Javier 23 лет назад
Родитель
Сommit
0cc2a5b351

+ 4 - 0
mcs/class/corlib/System.Collections/ChangeLog

@@ -1,3 +1,7 @@
+2003-03-05  Gonzalo Paniagua Javier <[email protected]>
+
+	* Queue.cs: fixed bug #39046.
+
 2003-02-15  Pedro Martínez Juliá  <[email protected]>
 
 	* Hashtable.cs: Make hashtable serializable (at least with binary

+ 8 - 10
mcs/class/corlib/System.Collections/Queue.cs

@@ -60,20 +60,18 @@ namespace System.Collections {
 			get { return this; }
 		}
 
-		public virtual void CopyTo (Array array, int index) {
-			if (array == null) {
-				throw new ArgumentNullException ();
-			}
+		public virtual void CopyTo (Array array, int index)
+		{
+			if (array == null)
+				throw new ArgumentNullException ("array");
 
-			if (index < 0) {
-				throw new ArgumentOutOfRangeException ();
-			}
+			if (index < 0)
+				throw new ArgumentOutOfRangeException ("index");
 
 			if (array.Rank > 1 
-			    || index >= array.Length 
-			    || count > array.Length - index) {
+			    || (index != 0 && index >= array.Length)
+			    || count > array.Length - index)
 				throw new ArgumentException ();
-			}
 			
 			int contents_length = contents.Length;
 			int length_from_head = contents_length - head;