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