代码辅助会有所帮助 - 或者我是唯一的白痴? [英] code assist would help - or am I the only idiot?

查看:48
本文介绍了代码辅助会有所帮助 - 或者我是唯一的白痴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说到尝试深入嵌套if-else块...


我经常发现从另一个缩进级别告诉它并不总是很容易

(授予我保持我的标签设置低,所以我不会在页面的中间位置通过

第3级),我发现自己做这样的事情来帮助我保持它

直:


class MyClass

{

public void SomeMethod()

{

blah blah blah

开关(某物)

{

case blah blah blah blah />
} // end:switch(something)

} // end:SomeMethod()

} // end:class MyClass


主要是因为当我正在处理代码并且需要在切换后插入功能

时,例如,它很明显地确切地说在哪里

代码。有人指出,结束是指结束。 VB的关键字确实使得它更具可读性,但是因为这些陈述并没有说什么。正好......

结束了这么多。


有没有其他人做过这类事,或者我是唯一一个喜欢的人

小标签缩进,或者只是唯一一个看不懂我自己代码的白痴?


如果我不是,那么这不是一个好的代码辅助功能,例如当你输入
类型" ///"在一种方法面前?


(我知道这不是一个动人的话题,但有时会有一些亮点来讨论这个问题。)是的,不是吗?)

Speaking of trying to read deeply nested if-else blocks...

I often find it''s not always easy to tell one indent level from another
(granted I keep my tab settings low so I''m not halfway across the page by
the 3rd level), and I find myself doing things like this to help me keep it
straight:

class MyClass
{
public void SomeMethod()
{
blah blah blah
switch (something)
{
case blah blah blah
} // end: switch (something)
} // end: SomeMethod()
} // end: class MyClass

Mainly so that when I''m working on the code and need to insert functionality
after the switch, for example, it is instantly obvious exactly where that
code goes. As someone pointed out, the "end" keywords of VB do make that a
little more readable, but as those statements don''t say "what" is being
ended only so much so.

Does anyone else do this sort of thing, or am I the only one that likes
small tab indents, or just the only idiot that can''t read my own code?

If I''m not, then wouldn''t this be a nice code assist feature like when you
type "///" in front of a method?

(I know it''s not an earth-moving topic, but sometimes something light to
discuss brightens the day a bit, doesn''t it?)

推荐答案

Daniel,


实际上,我认为可能是一个非常好的主意。当你在某些代码元素上放置一个

结束括号(并且你打开了

的特征)时,它会在开始括号之前插入该行(如果它是一个开关,

if,while等等)。这可能会对代码的可读性产生很好的影响。


我会把它转发给MS的某个人,他会看一下它(我会

提到这也是你的想法,以及你的电子邮件)。


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


丹尼尔比林斯利 <分贝********** @ NO.durcon.SPAAMM.com>在消息中写道

新闻:eL ************** @ TK2MSFTNGP12.phx.gbl ...
Daniel,

Actually, I think that might be a really good idea. When you place a
closing bracket on certain code elements (and you have the feature turned
on), it would insert the line before the opening bracket (if it is a switch,
if, while, etc, etc). This could have a good impact on code readability.

I''ll forward it to someone at MS who will take a look at it (and I will
mention it was your idea as well, and your email).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel Billingsley" <db**********@NO.durcon.SPAAMM.com> wrote in message
news:eL**************@TK2MSFTNGP12.phx.gbl...
说到尝试阅读深深嵌套if-else块...

我经常发现从另一个压缩级别告诉它并不总是很容易
(授予我保持我的标签设置低,所以我''我不会在页面的中间通过第3级),我发现自己正在做这样的事情来帮助我直接保持


类MyClass
{
public void SomeMethod()
{等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等:switch(something)
} //结束:SomeMethod()
} //结束:类MyClass

主要是这样当我正在处理代码时需要例如,在切换后插入
功能,它很明显地确切地说明了代码的去向。有人指出,结束是指结束。 VB的关键字确实使
更具可读性,但由于这些陈述不能说什么正在结束这么多。

是否有其他人做过这类事,或者我是唯一一个喜欢
小标签缩进的人,或者只是唯一的白痴那不能读我自己的代码吗?

如果我不是,那么这不是一个很好的代码辅助功能,比如当你输入
时/// "在一种方法面前?

(我知道这不是一个动人的话题,但有时候讨论的东西会稍微提亮一点,不是吗? )
Speaking of trying to read deeply nested if-else blocks...

I often find it''s not always easy to tell one indent level from another
(granted I keep my tab settings low so I''m not halfway across the page by
the 3rd level), and I find myself doing things like this to help me keep it straight:

class MyClass
{
public void SomeMethod()
{
blah blah blah
switch (something)
{
case blah blah blah
} // end: switch (something)
} // end: SomeMethod()
} // end: class MyClass

Mainly so that when I''m working on the code and need to insert functionality after the switch, for example, it is instantly obvious exactly where that
code goes. As someone pointed out, the "end" keywords of VB do make that a little more readable, but as those statements don''t say "what" is being
ended only so much so.

Does anyone else do this sort of thing, or am I the only one that likes
small tab indents, or just the only idiot that can''t read my own code?

If I''m not, then wouldn''t this be a nice code assist feature like when you
type "///" in front of a method?

(I know it''s not an earth-moving topic, but sometimes something light to
discuss brightens the day a bit, doesn''t it?)



我出于同样的原因一直这样做(标签缩进为2个字符,

BTW )。它绝对可以更容易地遵循嵌套的代码块。使用

您的示例代码,我只需删除结束:部分:


class MyClass

{

public void SomeMethod()

{

blah blah blah


开关(东西)

{

case blah blah blah


} //切换(东西)


} // SomeMethod()


} //类MyClass

另外,我通常会从评论中删除参数以保持简单:

SomeMethod(param1,param2)

{

blah blah blah


} // SomeMethod()

-Mike


" ;丹尼尔比林斯利 <分贝********** @ NO.durcon.SPAAMM.com>在消息中写道

新闻:eL ************** @ TK2MSFTNGP12.phx.gbl ...
I do that all the time for the same reasons (tab indent at 2 characters,
BTW). It definitely makes it easier to follow nested blocks of code. Using
your sample code, I just drop the "end:" portion:

class MyClass
{
public void SomeMethod()
{
blah blah blah

switch (something)
{
case blah blah blah

} // switch (something)

} // SomeMethod()

} // class MyClass
Also, I typically drop parameters from the comment to keep it simple:

SomeMethod( param1, param2 )
{
blah blah blah

} // SomeMethod()
-Mike

"Daniel Billingsley" <db**********@NO.durcon.SPAAMM.com> wrote in message
news:eL**************@TK2MSFTNGP12.phx.gbl...
说到尝试阅读深深嵌套if-else块...

我经常发现从另一个压缩级别告诉它并不总是很容易
(授予我保持我的标签设置低,所以我''我不会在页面的中间通过第3级),我发现自己正在做这样的事情来帮助我直接保持


类MyClass
{
public void SomeMethod()
{等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等:switch(something)
} //结束:SomeMethod()
} //结束:类MyClass

主要是这样当我正在处理代码时需要例如,在切换后插入
功能,它很明显地确切地说明了代码的去向。有人指出,结束是指结束。 VB的关键字确实使
更具可读性,但由于这些陈述不能说什么正在结束这么多。

是否有其他人做过这类事,或者我是唯一一个喜欢
小标签缩进的人,或者只是唯一的白痴那不能读我自己的代码吗?

如果我不是,那么这不是一个很好的代码辅助功能,比如当你输入
时/// "在一种方法面前?

(我知道这不是一个动人的话题,但有时候讨论的东西会稍微提亮一点,不是吗? )
Speaking of trying to read deeply nested if-else blocks...

I often find it''s not always easy to tell one indent level from another
(granted I keep my tab settings low so I''m not halfway across the page by
the 3rd level), and I find myself doing things like this to help me keep it straight:

class MyClass
{
public void SomeMethod()
{
blah blah blah
switch (something)
{
case blah blah blah
} // end: switch (something)
} // end: SomeMethod()
} // end: class MyClass

Mainly so that when I''m working on the code and need to insert functionality after the switch, for example, it is instantly obvious exactly where that
code goes. As someone pointed out, the "end" keywords of VB do make that a little more readable, but as those statements don''t say "what" is being
ended only so much so.

Does anyone else do this sort of thing, or am I the only one that likes
small tab indents, or just the only idiot that can''t read my own code?

If I''m not, then wouldn''t this be a nice code assist feature like when you
type "///" in front of a method?

(I know it''s not an earth-moving topic, but sometimes something light to
discuss brightens the day a bit, doesn''t it?)



" Daniel Billingsley" <分贝********** @ NO.durcon.SPAAMM.com>在消息中写道

新闻:eL ************** @ TK2MSFTNGP12.phx.gbl ...
"Daniel Billingsley" <db**********@NO.durcon.SPAAMM.com> wrote in message
news:eL**************@TK2MSFTNGP12.phx.gbl...
我经常发现它'并不总是很容易从另一个地方告诉一个缩进级别
(授予我保持我的标签设置低,所以我不是在第3级的页面中间),我发现自己在做事情这样可以帮我保持
直接:
} //结束:切换(某事)
} //结束:SomeMethod()
} //结束:类MyClass
I often find it''s not always easy to tell one indent level from another
(granted I keep my tab settings low so I''m not halfway across the page by
the 3rd level), and I find myself doing things like this to help me keep it straight:
} // end: switch (something)
} // end: SomeMethod()
} // end: class MyClass




代码中的噪音太多,只需学习并使用Ctrl-]找到匹配的{},

(),[],#地区...... #endregion等。


- 艾伦



Too much noise in the code, just learn and use Ctrl-] to find matching {},
(), [], #region...#endregion, etc.

-- Alan


这篇关于代码辅助会有所帮助 - 或者我是唯一的白痴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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