Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Captilizing a name in a ReSharper template

Tags:

resharper

Is there a way to create a template in ReSharper that capitalizes a name?

For example I'd like to do something like this:

private $type$ _$name$;
public $type$ $uppercase_name$
{
    get { return _$name$; }
    set { _$name$ = value; }
}

So when I enter "city" for $name$, $uppercase_name$ should automatically be "City".

like image 801
hattenn Avatar asked Mar 11 '13 15:03

hattenn


1 Answers

Ok I did it:

  1. When adding a template, on the right there's a part where you can choose a macro. Click on "Choose Macro" for uppercase_name.
  2. Go to the end of the list. There's a macro called "Value of another variable with the first character in upper case". Choose that.
  3. The part "another variable" will be in red in the macro selection part. Click on that.
  4. Choose name.

Enjoy!

P.S. I have ReSharper 7.1. This may not be applicable for earlier versions.

like image 102
hattenn Avatar answered Sep 19 '22 17:09

hattenn