[Mono-bugs] [Bug 38812][Min] Changed - Array.Copy doesn't check member types.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 11 Mar 2003 08:29:48 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by martin@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=38812

--- shadow/38812	Thu Feb 27 08:58:16 2003
+++ shadow/38812.tmp.5310	Tue Mar 11 08:29:48 2003
@@ -50,6 +50,45 @@
 }
 ====
 
 ------- Additional Comments From martin@ximian.com  2003-02-27 08:58 -------
 See also bug #38291.
 
+
+------- Additional Comments From martin@ximian.com  2003-03-11 08:29 -------
+Thanks to Tom Dorgan for pointing out that my test case was wrong.  It's supposed to be
+
+====
+
+using System;
+
+class A
+{
+}
+
+class B : A
+{
+}
+
+class C : A
+{
+}
+
+class X
+{
+        static void Test (A[] a)
+        {
+                B[] b = new B [a.Length];
+                a.CopyTo (b, 0);
+        }
+
+        static void Main ()
+        {
+                C[] c = new C [] { new C () };
+
+                Test (c);
+        }
+}
+====
+
+Note the `a.CopyTo (b, 0)' instead of `a.CopyTo (a,0)'.
+