Resharper Surround with Templates: ()
Resharper comes with live templates (ctrl + j) or surround with templates (ctrl+ alt + j) which helps with few key strokes and can save you considerable time over a period of day.
Of the available surround with templates, my most frequently used one is surrounding with curly braces, { }
If you use linq statements in your code, you will quickly realize how neat it would have been if there were a open and close bracket surround template, ( ).
No worries, it’s easy to create one, lets do it.
From VS.Net, go to Resharper menu and select live templates, switch to the surround templates, as shown in the following pic, notice the predefined templates.
Right click on User Templates, select new template.
Lets give the description and the action to perform and you are all set.
Lets test it. Write your linq query, apply the shortcut ctrl + alt + j and select more options.
Select the open and close bracket from User Templates and mark the Add to quick list option and you will get your linq query surrounded with ( ) brackets.
Next time when you select surround with, you will get your shortcut,
Write your linq, select the statement using ctrl + w (Resharper) and surround with brackets and continue the operation.
(from accountDetailEntity in accountDetailEntities
group accountDetailEntity by accountDetailEntity.AccountBalance
into grouping
select grouping). <--
Nice, these simple shortcuts saves a good amount of time . Thanks Resharper :)