c# $和@ 简化字符串格式化拼接

int age=18;
Console.WriteLine($"XiaoMing is \"{age}\" {{ years}} old");
Console.WriteLine($@"XiaoMing is \""{age}\""
{{ years}} old");
 
Console.Write( $"{DateTime.Now:yyyy-MM-dd}"); //支持表达式
 

 

 


 

posted @ 2019-11-14 10:59  Ace001  阅读(760)  评论(0编辑  收藏  举报