Re: Generic list and inheritance
- From: Doug Semler <dougsemler@xxxxxxxxx>
- Date: Wed, 26 Sep 2007 16:54:06 -0000
On Sep 26, 12:39 pm, "santi...@xxxxxxxxx" <santi...@xxxxxxxxx> wrote:
Hi everyone,
Lets say I have:
interface ICar
{
}
class Mercedes : ICar
{
}
Why can't I assign:
IList<ICar> cars = new List<Mercedes>();
thanks in advance,
Santi
MSDN and Rick Byers can explain generic type invariance better than I
could :)
http://msdn2.microsoft.com/en-us/library/ms228359(vs.80).aspx
http://blogs.msdn.com/rmbyers/archive/2005/02/16/375079.aspx
http://blogs.msdn.com/rmbyers/archive/2006/06/01/613690.aspx
.
- References:
- Generic list and inheritance
- From: santimbs@xxxxxxxxx
- Generic list and inheritance
- Prev by Date: Make anonymous post
- Next by Date: Re: Drawing Lines on specific panel
- Previous by thread: Generic list and inheritance
- Next by thread: Re: Generic list and inheritance
- Index(es):