I have the following code snippet:
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(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 in just 2010, you need to delete the comment around <int, int>.
Can someone clarify why this works in 2012, and where does the specification explain it?
source
share