C# 在字符串前加了$,这个 dollar 符号有什么用?美元符号是什么意思?
加了$能直接取{}里面的值,如果没有加,则会显示{this.mainReceiver}这类值。
例子:
不加$:要显示m_a,m_b
Console.WriteLine("this is a:{0},this is b:{1}",m_a,m_b));
加$:可将值直接放{}里:
Console.WriteLine($"this is a:{m_a} ,this is b:{m_b}");
- 上一篇 »php正则,删除字符串中的中英文标点符号
- 下一篇 »php 字符串函数