开发者

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 i开发者_开发百科s 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 ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜