How to Capitalize Property

Hello,

I am trying to figure out how to have resharper "conform" to my company coding standards. I use private fields with a "_" prefix and pascal casing as in the following: private int _customerTypeID = 0;

When I use Alt + Insert to create a property I get a property called customerTypeID. My company requires that public properties start with a capital letter (as in CustomerTypeID).

Is there a way to tell resharper to Capitalize the first letter of a property?

Thanks in advance!
-GuitarJ

3 comments
Comment actions Permalink

Hello GuitarJ,

Did you set Naming Style in Options?
Options / Languages / Common / Naming Style
You should have "_" as a prefix for instance fields.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


G> Hello,
G>
G> I am trying to figure out how to have resharper "conform" to my
G> company coding standards. I use private fields with a "_" prefix and
G> pascal casing as in the following: private int _customerTypeID = 0;
G>
G> When I use Alt + Insert to create a property I get a property called
G> customerTypeID. My company requires that public properties start with
G> a capital letter (as in CustomerTypeID).
G>
G> Is there a way to tell resharper to Capitalize the first letter of a
G> property?
G>
G> Thanks in advance!
G> -GuitarJ


0
Comment actions Permalink

Yes, I do have that set, and Resharper does put the "_" char for my fields. However if a private variable is declared as _foo. The generated property (alt+insert) is called foo() and I need it to be Foo(). Can I tell Resharper to capitalize the public property even though the private field is NOT capitalized?

Jeff

0
Comment actions Permalink

Hello GuitarJ,

I tried it several times in various combinations and it does work as expected,
i.e. creates capitalized properties (both in C# and VB.NET):

Class Type
Dim _field As Integer

Public ReadOnly Property Field() As Integer
Get
Return _field
End Get
End Property
End Class

Could you please send us your UserSettings.xml file? It is located in "%appdata%\JetBrains\ReSharper\v3.0\vs8.0"

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


G> Yes, I do have that set, and Resharper does put the "_" char for my
G> fields. However if a private variable is declared as _foo. The
G> generated property (alt+insert) is called foo() and I need it to be
G> Foo(). Can I tell Resharper to capitalize the public property even
G> though the private field is NOT capitalized?
G>
G> Jeff
G>


0

Please sign in to leave a comment.