Visual Studio的C#声明崩溃 [英] Visual Studio C# statement collapsing

查看:197
本文介绍了Visual Studio的C#声明崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编辑很长的code块(这绝对应该重构无论如何,但这超出了这个问题的范围),我常常向往崩溃语句块的能力,就像人们可以合拢功能块。也就是说,这将是巨大的,如果减号图标出现在code轮廓的一切大括号括起来。它似乎出现函数,类,区域,命名空间,usings,但不能用于有条件或迭代块。这将是非常美妙的,如果我能崩溃之类的东西如果,开关,foreaches,那种事!

When editing really long code blocks (which should definitely be refactored anyway, but that's beyond the scope of this question), I often long for the ability to collapse statement blocks like one can collapse function blocks. That is to say, it would be great if the minus icon appeared on the code outline for everything enclosed in braces. It seems to appear for functions, classes, regions, namespaces, usings, but not for conditional or iterative blocks. It would be fantastic if I could collapse things like ifs, switches, foreaches, that kind of thing!

谷歌搜索到该了一下,我发现,显然C ++在VS概述允许这样,但C#在VS概述没有。我真的不知道为什么。即使记事本+ +将因此这些倒塌,如果我选择C#的格式,所以我不知道为什么Visual Studio中没有。

Googling into that a bit, I discovered that apparently C++ outlining in VS allows this but C# outlining in VS does not. I don't really get why. Even notepad++ will so these collapses if I select the C# formatting, so I don't get why Visual Studio doesn't.

有谁知道一个VS2008的加载项,使这种行为?或某种隐藏设置的呢?

Does anyone know of a VS2008 add-in that will enable this behavior? Or some sort of hidden setting for it?

编辑补充:插入的地区当然是一种选择,它也已经发生了我,但坦率地说,我不应该在包装中已包裹在大括号...如果我去的区域的东西编辑现有的code,我只是重构它有关注更好的分离反正。 (包装的新方法,而不是地区;)

Edited to add: inserting regions is of course an option and it did already occur to me, but quite frankly, I shouldn't have to wrap things in a region that are already wrapped in braces... if I was going to edit the existing code, I would just refactor it to have better separation of concern anyway. ("wrapping" with new methods instead of regions ;)

推荐答案

尝试 C#纲要插件( @MSDN)(VS 2010只) - 将所有括号{}概述了C#的编辑器,不仅类及其成员,也是建筑内的

Try C# outline plugin (@MSDN) (VS 2010 only) - "Adds all braces {} outlining for C# editor, not only class and its members, but also constructions inside."

您可以找到每一个单独版本VS此插件的较新版本:

You can find newer versions of this plugin for each VS version separately:

请注意:如果分机似乎没有安装您使用浏览器下载后,请尝试使用内置在Visual Studio扩展管理器

Note: If the extension doesn't seem to install after you used a browser to download it, try using the built-in Visual Studio extension manager.

此外,对于2015年VS Visual Basic和C#大纲支持语法着色内倒塌块。

Also, there is Visual Basic and C# Outliner for VS 2015 that supports syntax coloring inside collapsed blocks.

这篇关于Visual Studio的C#声明崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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