The codes below are exactly the same, except that one is C# and the other one is VB.Net. C# compiles just fine, but VB.Net throws the warning:
Interfa
Summing up:
IEnumerable
then the warning would be justified. If you have an object that is both a sequence of Turtles and a sequence of Giraffes, then what happens when you implicitly convert it to sequence of Animal? Do you get Turtles or Giraffes? The runtime just picks one, which is not necessarily the behaviour you want.For some interesting discussion of the last point see the comments to my 2007 article on the subject:
http://blogs.msdn.com/b/ericlippert/archive/2007/11/09/covariance-and-contravariance-in-c-part-ten-dealing-with-ambiguity.aspx