Imagine a following public method:
public void DoSomethingWithInput(Input input)
{
if (IsInputNice(input))
{
DoNiceThingsWithInput(input);
}
else if (IsInputUgly(input))
{
DoUglyThingsWithInput(input);
}
else
{
HandleUnknownInput(input);
}
}
Now, provided all methods used inside are private, I would like to be able to sort them so that they appear beneath the DoSomethingWithInput method in the order they are used:
private bool IsInputNice(Input input) { }
private void DoNiceThingsWithInput(Input input) { }
private bool IsInputUgly(Input input) { }
private void DoUglyThingsWithInput(Input input) { }
private void HandleUnknownInput(Input input) { }
In other words, I want to be able to sort all methods by access modifier first and usage order second. Is there a way to achieve this automatically (e.g. by some Visual Studio extension)?
Thank you!
Maybe Regionerate can help you?
“Regionerate lets you define regions in your code and determine the way members (fields, methods, properties etc.) should be placed inside them.”