https://msdn.microsoft.com/en-us/library/dn961160.aspx

int apples = ;
// Before C# 6.0
System.Console.WriteLine(String.Format("I have {0} apples", apples));
// C# 6.0
System.Console.WriteLine($"I have {apples} apples");

var result = string.Format("{0}{1}{2}{3}", tempChannelId, tempIndex, tempType, tempDeviceId);

升级为

var result = $"{tempChannelId}{tempIndex}{tempType}{tempDeviceId}";

优越性在于,不需要考虑{0}{1}{2}{3}和后面的变量的顺序对应

Interpolated Strings的更多相关文章

  1. C# 6.0 内插字符串 (Interpolated Strings )

    讲Interpolated Strings之前,让我们先看EF Core 2.0 的一个新的特性:String interpolation in FromSql and ExecuteSqlComma ...

  2. [C#] 回眸 C# 的前世今生 - 见证 C# 6.0 的新语法特性

    回眸 C# 的前世今生 - 见证 C# 6.0 的新语法特性 序 目前最新的版本是 C# 7.0,VS 的最新版本为 Visual Studio 2017 RC,两者都尚未进入正式阶段.C# 6.0 ...

  3. PHP从PHP5.0到PHP7.1的性能全评测

    本文是最初是来自国外的这篇:PHP Performance Evolution 2016, 感谢高可用架构公众号翻译成了中文版, 此处是转载的高可用架构翻译后的文章从PHP 5到PHP 7性能全评测( ...

  4. PHP的性能演进(从PHP5.0到PHP7.1的性能全评测)

    本文是最初是来自国外的这篇:PHP Performance Evolution 2016, 感谢高可用架构公众号翻译成了中文版, 此处是转载的高可用架构翻译后的文章从PHP 5到PHP 7性能全评测( ...

  5. 升级 Visual Studio 2015 CTP 5 的坑、坑、坑

    前两天,微软发布了 Visual Studio 2015 CTP 5,全称为 Visual Studio 2015 Community Technology Preview 5,意为社区技术预览版,之 ...

  6. 创建ASP.NET Core MVC应用程序(1)-添加Controller和View

    创建ASP.NET Core MVC应用程序(1)-添加Controller和View 参考文档:Getting started with ASP.NET Core MVC and Visual St ...

  7. [C#6] 4-string 插值

    0. 目录 C#6 新增特性目录 1. 老版本的代码 internal class Person { public string Name { get; set; } public int Age { ...

  8. C# 6.0

    C# 6.0 的新语法特性   回眸 C# 的前世今生 - 见证 C# 6.0 的新语法特性 序 目前最新的版本是 C# 7.0,VS 的最新版本为 Visual Studio 2017 RC,两者都 ...

  9. 006.Adding a controller to a ASP.NET Core MVC app with Visual Studio -- 【在asp.net core mvc 中添加一个控制器】

    Adding a controller to a ASP.NET Core MVC app with Visual Studio 在asp.net core mvc 中添加一个控制器 2017-2-2 ...

随机推荐

  1. 【mongodb】 需求

    增删改查 增加:  (表名,增加内容) 删除: (表名,数据id) 改: (表名 根据id获取数据 修改 增加 查 (表名,字段 ) 关联查询? 请主站提供一下 在使用的接口

  2. 【nodejs】关于 alert 和 document

    Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation.保留所有权利. C:\Windows\system32>n ...

  3. Hello BaiduMap

    百度提供了地图的API,可以在android手机上用,这里其实只要参考百度给的文档就好了.因为api不断在更新,所以网上的博客感觉还是不太好,直接看官网的文档比较靠谱 这里照着百度文档上面提供的文档我 ...

  4. Java 8 VM GC Tuning Guide Charter2

    第二章 Ergonomics Ergonomics is the process by which the Java Virtual Machine (JVM) and garbage collect ...

  5. android动态增加控件时控制样式的方法

    在学习android的动画时,发现所谓的tween动画只是改变绘制效果并不改变原控件的位置时是颇为失望的,虽然3.0之后已经有了property animation,但是由于要兼容老版本的androi ...

  6. 关于6410的sd卡和nandflash启动的区别

    今天在公司我们队长问我个问题,关于cortex的sd启动流程和nandflash的启动流程,一下想不起来了,中午闲来无事就整理了整理当初6410的两种启动方式的区别.在这里写一下.有不对的请指点,我对 ...

  7. google chrome 32 升级变更找回user agent(google chrome lose user agent)

    chrome32中user agent 找不着了?没关系,看我画的图吧.为什么是英文的,国际化嘛...

  8. ssh-add 报错 Could not open a connection to your authentication agent

    ERROR: [root@testcentos01 ~]# ssh-add Could not open a connection to your authentication agent 在shel ...

  9. Mutex vs Semaphore

    What are the differences between Mutex vs Semaphore? When to use mutex and when to use semaphore? Co ...

  10. Java垃圾收集器

    概述 说起垃圾收集(Garbage Collection,GC),大部分人都把这项技术当做Java语言的伴生产物.事实上,GC的历史远远比Java久远,1960年诞生于MIT的Lisp是第一门真正使用 ...