这个问题可能看起来很迂腐或愚蠢,但是当涉及到首字母缩略词时,您对 Camel 套管的做法是什么?您是否坚持所有内容,甚至首字母缩略词都必须是驼峰式,或者您是否对首字母缩略词异常(exception)。解释也会很棒。我不确定这种做法如何影响 IDE 功能(自动完成)或行业标准是什么。
最佳答案
对于 C#,请查看 Microsoft's guidelines :
Do capitalize both characters of two-character acronyms, except the first word of a camel-cased identifier.
A property named DBRate is an example of a short acronym (DB) used as the first word of a Pascal-cased identifier. A parameter named ioChannel is an example of a short acronym (IO) used as the first word of a camel-cased identifier.
Do capitalize only the first character of acronyms with three or more characters, except the first word of a camel-cased identifier.
A class named XmlWriter is an example of a long acronym used as the first word of a Pascal-cased identifier. A parameter named htmlReader is an example of a long acronym used as the first word of a camel-cased identifier.
Do not capitalize any of the characters of any acronyms, whatever their length, at the beginning of a camel-cased identifier.
A parameter named xmlStream is an example of a long acronym (xml) used as the first word of a camel-cased identifier. A parameter named dbServerName is an example of a short acronym (db) used as the first word of a camel-cased identifier.
关于c# - Camel 套管的缩写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4504508/