weird problem…
Ive implemented covariance from example .
My target FW is 4.0.
How ever . I wanted to see if it fails on 3.5 /2 -> but it wont.
It cant be since covariance is from FW4.0.

After changing to 3.0 i Build and see : (+wont fail on runtime)


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.
Covariance was supported in framework 3, but not implemented in the compiler. You are using compiler 4 targeting framework 3.
This is mentioned in an Eric Lippert blog post, I’ll see if I can find it..
EDIT
To further clarify,: The Common Language Runtime and the C# compiler (csc.exe) are two separate things. Covariance and Contravariance where introduced to the CLR at version 2.0. They were not introduced to C# until version 4. You are using Compiler 4 to build version 3 IL which is why it works.