C# naming conventions for acronyms

前端 未结 8 2067
耶瑟儿~
耶瑟儿~ 2020-12-04 09:55

Regarding C# naming for acronyms, if I was writing a library related to the Windows API is there any strong convention toward either WindowsApi or WindowsAPI or is it just p

8条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 10:03

    "Framework Design Guidelines" 2nd edition by Krzysztof Cwalina and Brad Abrams pp.40-42

    3.1.2 Capitalizing Acronyms

    DO capitalize both characters on two-character acronyms, except the first word of a camel-cased identifier.

    System.IO
    public void StartIO(Stream ioStream)
    

    DO capitalize only the first character of acronyms with three or more characters, except the first word of a camel-cased identifier.

    System.Xml
    public void ProcessHtmlTag(string htmlTag)
    

    DO NOT capitalize any of the characters of any acronyms, whatever their length, at the beginning of a camel-cased identifier.

提交回复
热议问题