Java equivalent to #region in c#
I want to use regions for code folding in Eclipse ; how can that be done in Java?
An example usage in C#:
#region name
//code
#endregion
There's no such standard equivalent. Some IDEs - Intellij, for instance, or Eclipse - can fold depending on the code types involved (constructors, imports etc.), but there's nothing quite like #region
.
Jet Brains IDEA has this feature. You can use hotkey surround with for that (ctrl + alt + T). It's just IDEA feature.
Regions there look like this:
//region Description
Some code
//endregion
With Android Studio, try this:
//region VARIABLES
private String _sMyVar1;
private String _sMyVar2;
//endregion
Careful : no blank line after //region ...
And you will get:
链接地址: http://www.djcxy.com/p/42586.html上一篇: 从web.config读取连接字符串
下一篇: 相当于c#中#region的Java