Ok, don’t be cross with me, I know the comments aren’t clean code. But sometimes we need them. ReSharper templates is excellent possibility to write your comments quicker and personalized so you can ask the next time: “hey guy what did you meant with this?”.

Create ReSharper Template

Choose from the ReSharper menu Template Explorer entry image  In the Template Explorer choose in Scopes C# and then click on the New Template image In the new template write the following code. With the $ sign are marked parameters. The name of the parameters is up to you. image The name of the Shortcut is the word (or sequence of words) which triggers, together with the TAB, the template generation. The Availability defines where is the template accessible and Parameters is list of parameters we defined in the code before. image You assign Macro for each parameter as shown above and uncheck the Editable availability, except for the comment parameter. You save the template and you are ready to go. You can setup in the ReSharper Options Menu which items should be shown in To-do Explorer. image

Demo

1 comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.