unable to pas derived List<>
Posted
by Tarscher
on Stack Overflow
See other posts from Stack Overflow
or by Tarscher
Published on 2010-03-11T08:48:09Z
Indexed on
2010/03/15
9:39 UTC
Read the original article
Hit count: 157
Hi all,
I have
class A
{}
class B : A
{}
I also have a method that expects a List parameter
void AMethod(List<A> parameter)
{}
Why can't I
List<B> bs = new List<B>();
AMethod(bs);
And secondly what is the most elegant way to make this work?
regards
© Stack Overflow or respective owner