罗斯林和.NET运行库版本运行库、版本、罗斯林、NET

2023-09-03 04:43:45 作者:浪叔

是否有可能使用罗斯林编译器和C#6.0与旧版本的.NET运行库的新功能(例如,.NET 4.0)?

Is it possible to use Roslyn compiler and new features of C# 6.0 with old versions of .NET Runtime (for example, .NET 4.0)?

例如,我想使用ex pression健全成员( INT S => X + Y; 而不是 INT Š{{返回X + Y;}} )的.NET 4.0应用程序

For example, I want use the expression-bodied members (int S => x + y; instead of int S { get { return x + y; } }) in .NET 4.0 application.

推荐答案

新的C#6.0的功能不依赖于框架支持,所以是的,你用C#6.0编译器编译的应用程序将运行在.NET 4.0。

The new C# 6.0 features don't depend upon framework support so yes, you an app compiled with the C# 6.0 compiler will run on .NET 4.0.