isnullorempty()isnullorwhitespace()join()truncate()left()right()capitalize()
stringtemplate.format比string.format更好,因为它更易读且更不容易出错。
值的顺序可以很容易地进行格式化。这些值的格式化方式类似于string.format,但使用的是命名占位符而不是编号占位符。
以下是一个示例 −
string str = stringtemplate.format("{examname} will held on {examdate:d}", new { p.examname, p.examdate });
以上就是c#中的字符串模板类的详细内容。
