There are 1 entries for the tag VS2010
Wednesday, April 7, 2010 9:56 AM | Comments

Starting back in 2007 I read a series on Co/contra-variance in C# by Eric Lippert – Eric is on the compiler team at MS and one of my favorite bloggers to read I might add. At the time, I remember myself reading along with the words but my eyes completely glazing over. To be honest the concept mostly eluded me at the time, so I wanted to take this opportunity to describe the feature in a way that made the most sense to me. It Seems to Logical… Ask yourself the following questions: Is a List<string> also a List<object>? Is an IEnumerable<string> also an IEnumerable<object>? As you’ll see below, the answers to these questions depends entirely on the version of the C# compiler you are using. Turning our Questions into Tests Naturally,...