代码之家  ›  专栏  ›  技术社区  ›  Vinicius Gonçalves

Visual Studio-字符串插值快捷方式(不带Install VS Extensions)

  •  1
  • Vinicius Gonçalves  · 技术社区  · 7 年前

    我开始写一条消息,但不知道是否需要插入它。所以,我正在留言,想把 $

    如果有捷径的话会有帮助的。

    这样地:

    Log("Something happen here, at... (Oh God, I will need interpolate it..) {DateTime.Now}...");
    

    3 回复  |  直到 7 年前
        1
  •  1
  •   Mike Bovenlander    7 年前

    使用Resharper可以按 alt+enter 第一个建议是“字符串插值”。

    to string interpolation

        2
  •  1
  •   Sergey Vlasov    7 年前

    可以将以下命令添加到Visual Commander并为其指定快捷方式: Add the string interpolation character $ to the beginning of the current string

        3
  •  -1
  •   PurTahan    7 年前

    你可以在下面的案例中使用它 $ :

    Log($"Something happen here, at... (Oh God, I will need interpolate it..) {DateTime.Now}...");
    

    在使用之前,您需要安装 Microsoft.Net.Compilers 包裹 https://blogs.msdn.microsoft.com/benjaminperkins/2017/03/23/how-to-enable-c-7-in-visual-studio-2017/