[Mono-list] Generics Conversions

Sascha Leib sascha.leib at gmail.com
Mon Feb 23 07:58:43 EST 2009


Hello all,

I noticed one behaviour when using Generics:

            List<String> StringList = new List<String>();

            List<Object> ObjectList = (StringList as List<Object>);  //
Error

The error message is:
    Program.cs(14,51): error CS0039: Cannot convert type
`System.Collections.Generic.List<string>' to
`System.Collections.Generic.List<object>' via a built-in conversion

Is that a wanted behaviour? Or am I missing something? This really stops
me from using more Generics at the moment :-/

/sascha

PS: At least it is consistent with how VS handles it...




More information about the Mono-list mailing list