I was wondering if anyone could point me in the right direction…
How do I cast from ReadOnlyCollection<myDerivedType> to ReadOnlyCollection<myBaseType> without iterating or “newing up” a copy?
I am using .NET Framework 4.0
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can implicitly convert a
ROC<Derived>into anIEnumerable<Base>in C# 4, but not into aROC<Base>.That is unfortunate; it would be really nice to be able to do covariant conversions on immutable types.