gpt4 book ai didi

c# - 如何使用 StringBuilder AppendFormat 行

转载 作者:太空宇宙 更新时间:2023-11-03 23:18:31 27 4
gpt4 key购买 nike

我能做到:

myStringBuilder.AppendFormat("hello {0}", "world");

但是我做不到:

myStringBuilder.AppendFormatLine("hello {0}", "world");

我希望执行 AppendFormat 并在末尾附加一个换行符。我用上面的第二种方法得到的错误是 cannot convert from 'string' to 'object[]'

最佳答案

添加 .AppendLine() 将起作用。

myStringBuilder.AppendFormat("hello {0}", "world").AppendLine();

关于c# - 如何使用 StringBuilder AppendFormat 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36342466/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com