I just created a simple project in VS2010, C# dotnet 3.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Business.Util
{
public interface ICalculateCurrent<in T1, in T2, in T3, in T4>
{
bool GetValue(T1 obj1, T2 obj2, T3 obj3, T4 obj4);
}
public static class test
{
static void Main(string[] args)
{
}
}
}
Fine, doesn’t do anything at the moment but it compiles.
Then realizing that I really wanted to be doing this in VS2008, dotnet3.5 I created the exact same code and I get nothing but errors regarding the interface;
Invalid token 'in' in class, struct, or interface member declaration
Type expected
Invalid token ',' in class, struct, or interface member declaration
Invalid token ',' in class, struct, or interface member declaration
Invalid token ',' in class, struct, or interface member declaration
Invalid token '>' in class, struct, or interface member declaration
The project references are both the same. What am I missing on this?
thanks.
Variant interfaces require the VS2010 version of the C# compiler. Even though you’re targeting .NET 3.5, it was still using the new compiler.
No way to do this with VS2008, sorry. .NET 3.5 includes runtime support for variant interfaces but the older C# compiler doesn’t.
If you aren’t using interface variance, just remove
inall four times it appears on that line.