[Mono-list] Generics Conversions

Felipe Lessa felipe.lessa at gmail.com
Mon Feb 23 08:12:40 EST 2009


On Mon, Feb 23, 2009 at 9:58 AM, Sascha Leib <sascha.leib at gmail.com> wrote:
>            List<String> StringList = new List<String>();
>
>            List<Object> ObjectList = (StringList as List<Object>);  //
[snip]
> Is that a wanted behaviour? Or am I missing something? This really stops
> me from using more Generics at the moment :-/

Accepting this code would defeat the purposes of generics. You could,
for example, add an integer to the 'ObjectList', so how would
'StringList' return that integer as a string? It doesn't make any
sense.

-- 
Felipe.


More information about the Mono-list mailing list