是#地区的指令在.NET真的有用吗? [英] Is the #region directive really useful in .NET?

查看:111
本文介绍了是#地区的指令在.NET真的有用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

保持大量的code尸横#区域(在C#和VB.NET)后,在我看来,这个结构是只是一堆做工作的程序员。它的工作,把党的事情到code,然后他们使搜索和阅读code很讨厌。

After maintaining lots of code littered with #region (in both C# and VB.NET), it seems to me that this construct is just a bunch of "make work" for the programmer. It's work to PUT the dang things into the code, and then they make searching and reading code very annoying.

有什么好处?为什么codeRS去额外的麻烦,把这个在他们的code。

What are the benefits? Why do coders go to the extra trouble to put this in their code.

让我一个信徒!

推荐答案

一个的类似的问题已经问。

但...

我想说的不再。它本来是打算隐藏的从产生的WinForms code 的在.NET的早期版本。随着部分类需要似乎消失。恕我直言,现在得到的方式被滥用作为一种组织结构,没有编译任何价值。这一切都为IDE。

I would say not anymore. It was originally intended to hide generated code from WinForms in early versions of .NET. With partial classes the need seems to go away. IMHO it gets way overused now as an organizational construct and has no compiler value whatsoever. It's all for the IDE.

这篇关于是#地区的指令在.NET真的有用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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