I have the following piece of code:
namespace ConsoleApplication1
{
using System.Collections.Generic;
using System.Linq;
internal class Program
{
private static void Main(string[] args)
{
var bar = new object();
var result = new int[] { 1, 2, 3 }
.Select/* <int,int> */(bar.Test<int>)
.ToList();
}
}
public static class Extensions
{
public static TReturnType Test<TReturnType>(this object o, int e)
{
return default(TReturnType);
}
}
}
Compiling this on a machine with only Visual Studio 2012 works like a charm. However to compile it on a machine with just 2010 it is required that you remove the comment around the <int, int>
.
Can somebody elaborate on why this now works in 2012, and where in the spec this is explained?