Question about naming

Hi,

we use the naming convention where private variable in a class are named like this "_justToShowYou" where properties are named like this "JustToShowYou"

If I add the _ in the naming style for instance fields then ReSharper will add the _ but starts my variable with an upper case. Is there a way to tell him to start it with a lower case?

Thank you in advance.

4 comments
Comment actions Permalink

Hello Robert,

I've just tried it and it worked nice, i.e. it left first letter lowercase.
What is exactly your case, i.e. what are you doing when ReSharper suggest
wrong-cased field? Also, what version do you use? Thanks.

Sincerely,
Ilya Ryzhenkov

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


IR> Hi,
IR>
IR> we use the naming convention where private variable in a class are
IR> named like this "_justToShowYou" where properties are named like
IR> this "JustToShowYou"
IR>
IR> If I add the _ in the naming style for instance fields then
IR> ReSharper will add the _ but starts my variable with an upper case.
IR> Is there a way to tell him to start it with a lower case?
IR>
IR> Thank you in advance.
IR>


0
Comment actions Permalink

Hi,

I guess there's something I am doing wrong then. I went to Options > Naming style > Instance Fields and I put _ as prefix. Then when I ask ReSharper to autogenerate the fields for my properties I get _Variable instead of _variable.

Let me know if there's something that I should checked to make my first letter lowercase after the _ :)

Thanks you

0
Comment actions Permalink

Robert Lejeune wrote:

Hi,

I guess there's something I am doing wrong then. I went to Options > Naming style > Instance Fields and I put _ as prefix. Then when I ask ReSharper to autogenerate the fields for my properties I get _Variable instead of _variable.

Let me know if there's something that I should checked to make my first letter lowercase after the _ :)

Thanks you


Yes same problem here. As soon as you try to rename it (F2), it does
suggest the correct name.

0
Comment actions Permalink

As I reported in JIRA several months ago (I think back in the 1.x days),
this only works correctly when _ is assigned as a prefix and you are
encapsulating a field. It does not work when renaming a field and its
property, or renaming a property and its field. In general, renaming fields
and properties has never worked correctly. When renaming a field to
_fieldName, ReSharper is just as likely to recommend renaming the property
to _Fieldname, _FieldName, _FieldNAME, _FIELDname, and other bizarre twists.
I normally keep "rename related objects" disabled because it doesn't work
correctly.

"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:76a2bd0b145a788c9d40f039b1bb2@news.intellij.net...

Hello Robert,

>

I've just tried it and it worked nice, i.e. it left first letter
lowercase. What is exactly your case, i.e. what are you doing when
ReSharper suggest wrong-cased field? Also, what version do you use?
Thanks.

>

Sincerely,
Ilya Ryzhenkov

>

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

>
>

IR> Hi,
IR> IR> we use the naming convention where private variable in a class are
IR> named like this "_justToShowYou" where properties are named like
IR> this "JustToShowYou"
IR> IR> If I add the _ in the naming style for instance fields then
IR> ReSharper will add the _ but starts my variable with an upper case.
IR> Is there a way to tell him to start it with a lower case?
IR> IR> Thank you in advance.
IR>


0

Please sign in to leave a comment.