Вопрос

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.

Это было полезно?

Решение

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

http://blogs.msdn.com/b/ericlippert/archive/2009/07/06/color-color.aspx

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.

Другие советы

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

Wikipedia article about CamelCase has some useful information.

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.

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 ;)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top