添加换行符在C#代码页的背后 [英] Adding line break in C# Code behind page
问题描述
我已经写在其中超过页面宽度C#代码,所以我希望它按照我的格式被分解成下一行。我试着搜索了很多以获取换行符该字符,但没能找到答案。
I have written a code in C# which is exceeding page width, so i want it to be broken into next line according to my formatting. I tried to search a lot to get that character for line break but was not able to find out.
在VB.NET我用'_'为线断裂,同方法是什么在C#中使用吗?
我试图打破一个字符串。
In VB.NET I use '_' for line break, same way what is used in C# ? I am trying to break a string.
由于提前
山塔努·古普塔
Thanks in Advance Shantanu Gupta
推荐答案
< STRONG>选项A:连接几个字符串为一个:
Option A: concatenate several string literal into one:
string myText = "Looking up into the night sky is looking into infinity" +
" - distance is incomprehensible and therefore meaningless.";
选项B:使用一个多行字符串:
Option B: use a single multiline string literal:
string myText = @"Looking up into the night sky is looking into infinity
- distance is incomprehensible and therefore meaningless.";
通过选项B,换行字符(S)将被保存到变量<$字符串的一部分C $ C>会将myText 。这可能会,也可能不是,是你想要的。
With option B, the newline character(s) will be part of the string saved into variable myText
. This might, or might not, be what you want.
这篇关于添加换行符在C#代码页的背后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!