在字符串前加$相當於對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}");
在字符串前加$相當於對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刪除。