How can I create a more user-friendly string.format syntax?

前端 未结 6 2007
慢半拍i
慢半拍i 2020-11-27 10:29

I need to create a very long string in a program, and have been using String.Format. The problem I am facing is keeping track of all the numbers when you have more than 8-10

6条回答
  •  天命终不由人
    2020-11-27 11:05

    As of C#6, this kind of string interpolation is now possible using the new string interpolation syntax:

    var formatted = $"You are {age} years old and your last name is {name}";
    

提交回复
热议问题