Alex Rivera | Logout

How do I sort lines of code alphabetically in Visual Studio?

Asked 2011-10-26T10:52:07.353
29

Possible Duplicate:
Sort selected text from Visual Studio context menu

I have some lines of code I wish to sort alphabetically, nothing clever.

I wish to just select the lines, and then sort them. (I could copy them into Excel then sort and copy them back, but there must be a better way)

This is the bit of code I am trying to time, in real life it is a lot longer…

sortingColumnOverrides: new Dictionary<Enum, Enum>()
{
   {Cols.SimulationPrice,Cols.SimulationPriceRange},                
   {Cols.BaselineEffectivePrice, Cols.BaselineEffectivePriceRange},                
   {Cols.SimulationEffectivePrice, Cols.SimulationEffectivePriceRange},                
   {Cols.SimulationCost, Cols.SimulationCostRange},                
   {Cols.BaselinePrice,Cols.BaselinePriceRange},                
   {Cols.BaselineCost,Cols.BaselineCostRange},                
   {Cols.PriceLiftAbs, Cols.SimulationPriceChangeRange},                
   {Cols.PriceLiftPct, Cols.SimulationPriceChangePercentRange},                
   {Cols.BaselinePricePerUOM, Cols.BaselinePricePerUOMRange},                
   {Cols.SimulationPricePerUOM, Cols.SimulationPricePerUOMRange},   
   //lots more lines like these....
}

More marks, if there is a easy way to stop the sort at the first ",", but that would just be icing on the cake.

(Other questions in the past of ask about the more complex task of sorting methods by name etc.)

Edit
Report

1 Answer

3
answered 2011-10-26T11:40:19.227

Your Answer