namespace TestLibrary
{
[TestFixture]
public class Class1
{
public delegate T Initializer<T>();
public static T MyGenericMethod<T>(Initializer<T> initializer) where T : class
{
return initializer != null ? initializer() : null;
}
[Test]
public void Test()
{
var result = MyGenericMethod(MyInitializer);
Assert.IsNotNull(result);
}
private object MyInitializer()
{
return new object();
}
}
}
This is a functioning piece of code when running in Visual Studion 2010. If I try to build this using MSBUILD from command line...
"c:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe" Solution1.sln
... I get very familiar error message:
The type arguments for method 'Method name' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Any ideas?
/tv:3.5
option will get me an error again. – Radek Stromský