gpt4 book ai didi

c# - 有没有办法在 VS2010 中强制换行?

转载 作者:行者123 更新时间:2023-12-02 05:21:15 31 4
gpt4 key购买 nike

举个例子。

MessageBox.Show("You cannot create an incident and also provide a Case Number\nPlease choose one or the other");

我想像这样把它放在两行上,但没有 + 运算符

MessageBox.Show("You cannot create an incident and also provide a Case Number\n" + 
"Please choose one or the other");

但我想知道“是否有一些转义字符可以让我在没有字符串连接的情况下做到这一点?”

最佳答案

您可以这样做(注意您不能缩进第二行,否则缩进将成为字符串的一部分):

MessageBox.Show(@"You cannot create an incident and also provide a Case Number
Please choose one or the other");

但实际上您不必担心将 + 字符串连接用作 the compiler will optimize it away .

关于c# - 有没有办法在 VS2010 中强制换行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13803881/

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