首页 > Windows开发 > 详细

C# $的用法

时间:2019-11-06 11:25:27      阅读:72      评论:0      收藏:0      [点我收藏+]
在字符串前加$相当于对string.format()的简化
如:
int m_a = 1;
int m_b = 2;
使用string.format():
Console.WriteLine(string.format("this is a:{0},this is b:{1}"),m_a,m_b));

使用了$,就可以在原来占位符的地方直接用参数代替
Console.WriteLine($"this is a:{m_a} ,this is b:{m_b}");

 

C# $的用法

原文:https://www.cnblogs.com/darkif/p/11803960.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!