Captilizing a name in a ReSharper template

断了今生、忘了曾经 提交于 2019-12-04 16:40:09

问题


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".


回答1:


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.



来源:https://stackoverflow.com/questions/15342501/captilizing-a-name-in-a-resharper-template

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!