串插不与.NET框架4.6工作 [英] String interpolation doesn't work with .NET Framework 4.6

查看:127
本文介绍了串插不与.NET框架4.6工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚安装了.NET Framework 4.6我的机器上,然后创建了一个面向ConsoleApplication的.NET Framework 4.6和Visual Studio 2013。

I just installed the .NET Framework 4.6 on my machine and then created a ConsoleApplication targeting .NET Framework 4.6 with Visual Studio 2013.

我写在下面方法:

  string test = "Hello";
  string format = $"{test} world!";



但是,这并不编译。做同样在Visual Studio 2015年的作品。结果
为什么?

But this does not compile. Doing the same in Visual Studio 2015 works.
Why?

推荐答案

路线插值是一个C#6.0的功能不是的.NET Framework 4.6中的一个。 VS 2013不支持C#6,但2015年VS做。

String interpolation is a C# 6.0 feature, not one of .NET Framework 4.6. VS 2013 doesn't support C# 6 but VS 2015 does.

这篇关于串插不与.NET框架4.6工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆