[Mono-bugs] [Bug 632159] Generics Crash

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Aug 18 15:36:28 EDT 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=632159#c1


Jonathan Pryor <jpryor at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jpryor at novell.com

--- Comment #1 from Jonathan Pryor <jpryor at novell.com> 2010-08-18 19:36:28 UTC ---
Related semantic question: assume the above works.  What should
myList.Get(0).GetType().FullName return?

We're now entering the realm of "funny corner cases," so which is the clearer
set of semantics?

Given:

    var list = new LinkedList<object>();
    list.Add(true);
    Logger.Log(LogLevel.Info, "testing", list.Get(0).GetType().FullName);

One of two things can be printed from the above.

Option 1 is for System.Boolean to be printed.  The implication though is that
this will fail:

    var list = new LinkedList<object>();
    list.Add(new Java.Lang.Boolean (true));
    Assert.AreEqual ("Java.Lang.Boolean", list.Get(0).GetType().FullName);

Option 2 is for Java.Lang.Boolean to be printed.

The problem is that we're dealing with an intermediary that can't tell what you
originally stuffed in the list, as it's separated by a wrapper type.

To avoid this whole mess, you could just use LinkedList<bool>, which will allow
adding and getting System.Boolean instances...

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


More information about the mono-bugs mailing list