How do I collapse selected chunks of code in Visual Studio 2008?

前端 未结 3 1612
故里飘歌
故里飘歌 2020-12-30 22:59

In Visual Studio 2008: Is there a way for me to customly collapse bits of code similar to like how I can automatically collapse chunks of comments?

3条回答
  •  鱼传尺愫
    2020-12-30 23:18

    Your piece of code needs to be a block surrounded by, as desired:

    • braces
    • #region and #endregion in C#
    • #pragma region and #pragma endregion in C/C++

    If you can't collapse statement blocks, you need to enable this feature :

    Tools -> Options -> Text Editor -> C/C++ -> Formatting -> check everything in "outlining"

    (In Visual Studio 2013 it's Tools -> Options -> Text Editor -> C/C++ -> View)

    Then, reopen the source file to reload outlining.

提交回复
热议问题