C# cast Foo<Bar> to Foo<object>
Posted
by Michael
on Stack Overflow
See other posts from Stack Overflow
or by Michael
Published on 2010-04-07T16:56:37Z
Indexed on
2010/04/07
17:03 UTC
Read the original article
Hit count: 406
Hi, does anyone know if it is possible to cast a generic type with a certain type parameter (e.g. Bar) to the same generic type with the type parameter being a base type of Bar (such as object in my case). And, if it is possible, how would it be done?
What I want to do is have a collection of Foo but be able to add Foos with more specific type arguments.
Thanks
© Stack Overflow or respective owner