When working on C#, I often do this:
#region Properties
public int Property1{get;set;}
...(more properties)
#endregion
This makes Visual Studio add the option to fold the code inside the region. Offcourse, you can use regions for anything, it's not limited to Properties or anything at all.
I'm wondering 2 things:
- Is this just something to make Visual Studio add code folding to an area of the editor or does it affect the compiler?
- Can I do something similar in Netbeans?
In NetBeans you can use Custom Folds, depending on the language:
// <editor-fold defaultstate="collapsed" desc="My Fold">
Your amazing code
// </editor-fold>
The attributes are optional. Without
defaultstate
specified the region will default to expand (except for when you first wrap code in it!)One caveat to the folding reference:
I wrote a Macro for folding by mouse draging.
My shortcute:
CTRL+SHIFT+Q
Folding Macro:
UNFolding Macro Shortcut:
ctrl+SUBTRACK
The latest Netbeans 8.1 has already this feature build in, You need just select you rows and then click on the "light bulb" icon, then select:
enter code hereSurround with // <editor-fold defaultstatus="collapsed" desc="comment">...
This is the source: http://wiki.netbeans.org/SurroundWithCodeFolding