C# $的用法


在字符串前加$相当于对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}");

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM