Reply To: C# #region support

Product Compare Forums Multi-Edit Suggestions C# #region support Reply To: C# #region support

#3550
Aquineas
Participant

My apologies for being so vague. Visual Studio will collapse/expand the code in a region, allowing for a very simple way of organizing source code within a file so that one can optionall hide code that one isn’t interested in.

So given some C# code:
[code:2m0wysi9]
public class RetirementPlanner
{

public RetirementPlanner()
{
}

#region superfluous code
public byte[] PredictLottoNumbers( DateTime date )
{
byte[] rvalue=null;

return rvalue;
}
#endregion
}
[/code:2m0wysi9]
The PredictLottoNumbers method (along with any other code between the #region/#endregion tags), could be shown as inline code or collapsed. It seems the built-in collapsed code is *almost* there. What’s needed is a means to specify not just a search string, but a begin and end search string.

For example: a collapsable block could be defined as a pair of search strings. The first one would be #region and the second one ends with #endregion. Does that make sense?