开发者

Should all the identifiers of static properties with accessors start with uppercase letters?

I can't see anywhere that this should be the case, but I get an "Invalid declaration syntax" error in the get everytime I declare a static property that 开发者_运维技巧does not start with an uppercase letter. E.g:

type Foo() = class
    static member bar 
        with get() = "bar" //Invalid declaration syntax in get
end


This is simply a bug in Beta2/October CTP. It only affects static properties that use the 'with get/set' syntax. You can use just the shorter syntax

static member bar = "bar"

as a workaround, assuming you only need a getter.


To answer your question 'yes'. Property names should be capitalized as per the .NET coding guidelines. Unless you have a specific reason to have it be a lower case identifier, please have it be PascalCased.

http://msdn.microsoft.com/en-us/library/xzf533w0(VS.71).aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜