csharp IDE长行代码到多行 [英] csharp IDE long lines to code to multiline
本文介绍了csharp IDE长行代码到多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用csharp express 2005.
我在IDE中遇到问题,当我有一行代码时或者一个静态字符串中的长文本行,我想让它多行为
easir可读性,但使用< returnor< shift returndosnt似乎
允许将长代码行分解为mutliline并仍然编译
我确定已经看过这个,但是如何在ide中完成?
谢谢
Peted
解决方案
使用字符串,你有两个基本的选项:
a:使用@前缀并在字符串中包含返回值 - 即
string longString = @"这是一个
包含
换行符的长字符串" ;;
或b:使用几个字符串(在源代码中),然后让编译器针脚
它们在一起,即
string longString ="这是a \ n +
包含\ n的长字符串+
换行符;
有什么用吗?
Marc
应该发生在我身上谢谢。
c#代码的长行怎么样,而不是那个将是一个comman
问题,但我很好奇,以防万一我最终得到一长串的实际c#代码,是否有任何方法可以使多行仍然编译?b $ b编译?
谢谢
Peted
2007年5月9日星期三10:45:48 +0100," Marc Gravell
< ma ********** @ gmail.comwrote:
>带字符串,你有两个基本选择:
a:使用@前缀并在字符串中包含返回值 - 即
字符串longString = @"这是一个长的
包含
换行符的字符串" ;;
或b:使用几个字符串(在源代码中),让编译器将它们组合在一起,即
string longString =" this是一个不是 +
包含\ n的长字符串+
换行符;
任何用途?
Marc
>
c#是自由格式;只有少数事情(文字,评论等)挑剔
关于换行;以下编译得很好(但很难看,因为
sin ;-p):
foreach
(
char
c
in
" abcdef"
){
控制台。 WriteLine
(
c);
}
Marc
Hi,
im using csharp express 2005.
I have a problem in the IDE, when i have along line of code or a long
line of text in a static string, i want to make it multi line for
easir readability, but using <returnor <shift returndosnt seem to
allow for breaking long code lines into mutliline and still compile
Im sure ive seen this done, but how is it done in the ide ?
thanks
Peted
解决方案
With strings, you have two basic options:
a: use the @ prefix and include returns in the string - i.e.
string longString = @"this is a
long string that contains
line breaks";
or b: use a few strings (in the source), and let the compiler stitch
them together, i.e.
string longString = "this is a\n" +
"long string that contains\n" +
"line breaks";
Any use?
Marc
that should have occured to me thanks.
what about long lines of c# code, not that that will be a comman
problem, but im curious just in case i end up with a long line of
actual c# code, is there any way to make that multi line and still
compile?
thanks
Peted
On Wed, 9 May 2007 10:45:48 +0100, "Marc Gravell"
<ma**********@gmail.comwrote:
>With strings, you have two basic options:
a: use the @ prefix and include returns in the string - i.e.
string longString = @"this is a
long string that contains
line breaks";
or b: use a few strings (in the source), and let the compiler stitch
them together, i.e.
string longString = "this is a\n" +
"long string that contains\n" +
"line breaks";
Any use?
Marc
c# is free-form; only a few things (literals, comments etc) are fussy
about line breaks; the following compiles just fine (but is ugly as
sin ;-p):
foreach
(
char
c
in
"abcdef"
) {
Console.WriteLine
(
c);
}
Marc
这篇关于csharp IDE长行代码到多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文