Whidbey:希望在C#中实现替代代码布局 [英] Whidbey: Hopefully to implement alternativ code layouts in C#

查看:65
本文介绍了Whidbey:希望在C#中实现替代代码布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚读到了关于新的Whidbey的内容,我认为它为程序员提供了很好的功能。


HTML编辑器带有一个一堆很棒的格式化选项。如果C#也能获得其中一些选项,那将是非常好的。例如,我喜欢使用缩进的大括号来编写代码
,例如:


byte x()

{byte i = 1;


if(y(i))

{i + = 1;

z(i);}


返回i<< 1;}


并且非常感谢C#支持这种格式化时

自动重新格式化我的代码。

I''ve just read about the new Whidbey, which I think gives great features to
the programmer.

The HTML editor comes with a bunch of great formatting options. It''d be
great if C# would get some of these options, too. I, for example, prefer to
write code using indented braces, like:

byte x()
{byte i=1;

if (y(i))
{i+=1;
z(i);}

return i<<1;}

and would quite appreciate if C# supported this kind of formatting when
automatically reformatting my code.

推荐答案

Axel Dahmen< NO ***** @ NoOneKnows.de>写道:
Axel Dahmen <NO*****@NoOneKnows.de> wrote:
我刚刚读到了关于新的Whidbey的内容,我认为它为程序员提供了很多功能。

HTML编辑器附带了一堆伟大的格式选项。如果C#也能获得其中一些选项,那将是非常好的。例如,我喜欢使用缩进的大括号来编写代码,例如:

字节x()
{byte i = 1;

如果(y(i))
{i + = 1;
z(i);}

返回i<< 1;}

非常感谢C#支持这种格式化时
自动重新格式化我的代码。
I''ve just read about the new Whidbey, which I think gives great features to
the programmer.

The HTML editor comes with a bunch of great formatting options. It''d be
great if C# would get some of these options, too. I, for example, prefer to
write code using indented braces, like:

byte x()
{byte i=1;

if (y(i))
{i+=1;
z(i);}

return i<<1;}

and would quite appreciate if C# supported this kind of formatting when
automatically reformatting my code.




我非常怀疑这将是一个选项,只是因为它不是一种常用的格式化风格 - 我不记得曾经有人在任何Java,C,C ++或C#中使用过它。我确定还有其他程序员

在那里使用它,但可能还不足以让它值得MS

花时间为他们/实现格式化风格你的

福利。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复该团体,请不要给我发邮件



I very much doubt that that''ll be an option, simply because it''s not a
commonly used formatting style - I don''t recall ever seeing anyone use
it for any of Java, C, C++ or C#. I''m sure there are other programmers
out there who use it, but probably not enough to make it worth MS
spending the time implementing a formatting style for their/your
benefit.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too




" Axel Dahmen" < NO ***** @ NoOneKnows.de>在消息中写道

新闻:uQ ************** @ TK2MSFTNGP12.phx.gbl ...

"Axel Dahmen" <NO*****@NoOneKnows.de> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
我只是阅读有关新的Whidbey的内容,我认为它给程序员带来了很多功能。

HTML编辑器附带了许多很棒的格式化选项。如果C#也能获得其中一些选项,那将是非常好的。例如,我更喜欢
使用缩进大括号编写代码,例如:

字节x()
{byte i = 1;

如果(y(i))
{i + = 1;
z(i);}

返回i<< 1;}

非常感谢C#支持这种格式化时
自动重新格式化我的代码。
I''ve just read about the new Whidbey, which I think gives great features to the programmer.

The HTML editor comes with a bunch of great formatting options. It''d be
great if C# would get some of these options, too. I, for example, prefer to write code using indented braces, like:

byte x()
{byte i=1;

if (y(i))
{i+=1;
z(i);}

return i<<1;}

and would quite appreciate if C# supported this kind of formatting when
automatically reformatting my code.




这是我见过的最糟糕的编码风格。让我们一起来吧...... b $ b frank ...如果你在面试时把它作为你的样本代码提出

和我在一起,我会立即告诉你最快捷的方式到后门...


字节x()

{

字节i = 0;


if(y(i))

{

i + = 1;

z(i);

}


返回i<< 1;

}


这是正确的风格,并通过对齐开口来促进易于识别的

代码块的概念并且关闭括号......虽然我会勉强接受以下(签署的意向书改为

以上格式以继续有酬职业):


字节x(){

字节i = 0;


if(y(i)){

i + = 1;

z(i);

}


返回i<< 1;

}


为什么人们坚持要保存一行代码以支持更加困难

代码的可读性和维护?我不知道。



That has got to be the worst coding style I have ever seen. Let''s be
frank... if you were to present this as your sample code at a job interview
with me, I would immediately show you the quickest way to the back door...

byte x()
{
byte i = 0;

if (y(i))
{
i += 1;
z(i);
}

return i << 1;
}

That is the correct style, and promotes the concept of easy identifiable
code blocks by aligning the opening and closing braces... though I would
grudgingly accept the following (with a signed letter of intent to change to
the above format for continued gainful employment):

byte x() {
byte i = 0;

if (y(i)) {
i += 1;
z(i);
}

return i << 1;
}

Why people insist on saving one line of code in favor of far more difficult
code readability and maintenance? I have no idea.


On Thu,2003年10月30日22:58:00 -0500,The Posting One

< fe*****@blah.com>写道:
On Thu, 30 Oct 2003 22:58:00 -0500, "The Posting One"
<fe*****@blah.com> wrote:
为什么人们坚持要保存一行代码,以支持更难的代码可读性和维护?我不知道。
Why people insist on saving one line of code in favor of far more difficult
code readability and maintenance? I have no idea.




因为他们认为这种格式使得代码更易读,而不是更少的b / b $ per bnce?保存一行代码当你在页面上有10个构造时,每个构造显示了更多的代码,并且编辑器

一次只显示25行左右。较少的垂直空白也是b $ b意味着更少的视觉中断,特别是当以下陈述中的前导和后续陈述密切相关时(通常是这样)。


当然这种格式很难以你编写的方式阅读,

因为你使用了太少的无效 - 标准是4

空格,而不是二。请注意,显示器比它们的高度宽...

-
http://www.kynosarges.de


这篇关于Whidbey:希望在C#中实现替代代码布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆