vs2008和vs2010之间的公共接口差异?

Chr*_*ein 0 c# visual-studio-2010 visual-studio-2008

我刚在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)
            {

            }
        }
}
Run Code Online (Sandbox Code Playgroud)

很好,目前没有做任何事情,但它编译.

然后意识到我真的想在VS2008中做这个,dotnet3.5我创建了完全相同的代码,除了关于接口的错误我什么也得不到;

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
Run Code Online (Sandbox Code Playgroud)

项目参考是相同的.我对此缺少什么?

谢谢.

Ben*_*igt 6

变体接口需要VS2010版本的C#编译器.即使你的目标是.NET 3.5,它仍然使用新的编译器.

对不起,VS2008无法做到这一点..NET 3.5包含对变体接口的运行时支持,但旧的C#编译器不支持.

如果您没有使用界面差异,只需删除in该行上显示的所有四次.