C# tutorials - covariance and contravariance
Show how to enable implicit conversion of generic type parameters in interfaces and delegates in C#.
Tutorials should include one or more code examples, each example should also show expected output and should include an explanation of the code where it isn't obvious. Examples shouldn't be dependent on a specific IDE or target platform.
This topic might be better covered under arrays and collections. (The collections issue is #57)
Developers may not realize they want information about Covariance and Contravariance, but they will care about the effects when those features cause bugs when working with arrays.
@BillWagner what are your thoughts on explicitly discouraging the use of array covariance?
Jon Skeet's answer to a question on the topic comes to mind:
string[] strings = new string[1];
object[] objects = strings;
objects[0] = new object(); // Compiles happily, but blows up at runtime
I agree - I'm also looking at de-emphasizing the Covariance and Contravariance topics in the MSDN docs.
@cartermp Yes, array covariance should be explicitly discouraged. Now that there is safe covariance with generics, there's not a good reason.
When completed, let's add a link to this from delegates-strongly-typed.md