[Mono-bugs] [Bug 440819] Array generic interfaces are not type-safe

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 3 20:33:43 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=440819

User rkumpera at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440819#c3


Rodrigo Kumpera <rkumpera at novell.com> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |rkumpera at novell.com
             Status|RESOLVED                                        |REOPENED
         Resolution|FIXED                                           |




--- Comment #3 from Rodrigo Kumpera <rkumpera at novell.com>  2008-11-03 18:33:42 MST ---
Paolo, you forgot that arrays implement way more interfaces than just object.
The following piece of code doesn't throw an exception.


using System;
using System.Collections.Generic;

class A {}
class B : A{}

class C : A {
  static void Main ()
  {
    B [] aa = new B [1];
    IList<A> io = aa;
    io [0] = new C ();
    B a = aa [0];
    Console.WriteLine ("{0}", a.GetType ());
  }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list