Freshblood
Freshblood

Reputation: 6431

Newbie question about PascalCase

ReSharper extension of VS suggest me to use PascalCase in below property.

public Color Color { get; private set; }

Here Color is Enum type. I would never thought this can be possible because it is same name with type. But it is valid. Is it something suggested by general rules ? Do I have to listen ReSharper always ? Would be appreciated good reference links for PascalCase.

Upvotes: 2

Views: 186

Answers (4)

kgiannakakis
kgiannakakis

Reputation: 104178

Yes this is recommended. I suggest that you follow ReSharper guidelines, especially if you are new to programming.

Wikipedia article about CamelCase has some useful information.

Upvotes: 0

Ed Swangren
Ed Swangren

Reputation: 124692

This is called the Color Color problem actually and is explained here;

Link

And yes, it is supposed to work and follows the naming typically agreed upon naming convention rules. I would leave it as you show it in your example.

Upvotes: 7

Dima Stefantsov
Dima Stefantsov

Reputation: 973

http://msdn.microsoft.com/en-us/library/ms229043.aspx

The following guidelines provide the general rules for identifiers.

Do use Pascal casing for all public member, type, and namespace names consisting of multiple words.

Listen to ReSharper ;)

Upvotes: 0

Paul Creasey
Paul Creasey

Reputation: 28844

The syntax highlighting on here makes it particularly confusing, but the compiler know when to expect a type and when to expect a name so its no problem.

Upvotes: 1

Related Questions