This way of "Code folding" is best way to fold as:
Can fold any method,
Fold statements within any method, or any loop (ex. if,else,for) in case you have many statements inside any method/loop.
In the top of classes we define many Variables and if you have very big class there will more-n-more variables added day-by-day as class grows, it will good if you group all the definition in one-or-more 'region'.
The best use I found as if you review code of many developers in various projects and there is too many things to remember with requirements. Then, its a good practice to "Group all related methods in One 'region/endregion' with a good description. Its really helpful for next developer/reviewer/lead/manager to change/modify the code where it helps as not to wander/lost in whole file and scroll here-n-there/top-to-bottom and lose something in between.
Well, many of us use method separator(in Android Studio) and defining a rule for everybody/team as to use, line gap/space to grouping the similar statements within code block(method/loop) is not helpful and tough to consider/follow, in that case, this 'region/endregion' rule comes very handy.
You can use this in Visual Studio for C# as well.
And, Thanks Nate : for gathering all these Tips/hacks at one place.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
//region ${ Your Comment }
....
....
//endregion
This way of "Code folding" is best way to fold as:
You can use this in Visual Studio for C# as well.
And, Thanks Nate : for gathering all these Tips/hacks at one place.