避免使用由经常使用的名称空间复制的类型名。类型名不能使用下列词语。
System Collections Forms UI
避免使用与常用关键词冲突的标识符。例如,避免使用下列词语。
中国3S吧 3s8.cn
专业的3S站 3s8.cn
中国3S吧 3s8.cn
中国3S吧 3s8.cn
AddHandler |
AddressOf |
Alias |
And |
Ansi |
As |
Assembly |
Auto |
BitAnd |
BitNot |
BitOr |
BitXor |
Boolean |
ByRef |
中国3S吧 3s8.cn Byte |
ByVal |
Call |
Case |
Catch |
CBool |
CByte |
CChar |
CDate |
CDec |
CDbl |
Char |
CInt |
Class |
CLng |
CObj |
| 专业的3S站 3s8.cn Const |
CShort |
CSng |
CStr |
CType |
Date |
Decimal |
Declare |
Default |
Delegate |
Dim |
Do |
Double |
Each |
Else |
ElseIf |
中国3S吧 3s8.cn End |
Enum |
Erase |
Error |
Event |
Exit |
ExternalSource |
False |
Finally |
For |
Friend |
Function |
Get |
GetType |
Goto |
Handles |
专业的3S站 3s8.cn If |
Implements |
Imports |
In |
Inherits |
Integer |
Interface |
Is |
Let |
Lib |
Like |
Long |
Loop |
Me |
Mod |
Module |
专业的3S站 3s8.cn MustInherit |
MustOverride |
MyBase |
MyClass |
Namespace |
New |
Next |
Not |
Nothing |
NotInheritable |
NotOverridable |
Object |
On |
Option |
Optional |
专业的3S站 3s8.cn Or |
Overloads |
Overridable |
Overrides |
ParamArray |
Preserve |
Private |
Property |
Protected |
Public |
RaiseEvent |
ReadOnly |
ReDim |
Region |
REM |
中国3S吧 3s8.cn RemoveHandler |
Resume |
Return |
Select |
Set |
Shadows |
Shared |
Short |
Single |
Static |
Step |
Stop |
String |
Structure |
Sub |
SyncLock |
中国3S吧 3s8.cn Then |
Throw |
To |
True |
Try |
TypeOf |
Unicode |
Until |
Variant |
When |
While |
With |
WithEvents |
WriteOnly |
Xor |
eval |
| 专业的3S站 3s8.cn extends |
instanceof |
package |
var |
标识符(包括参数名)中不要使用缩写。
如果必须使用缩写:
任何超过两个字符以上的缩写都使用camel大写格式,即使这不是标准缩写。
名称空间
命名名称空间的一般规则如下:
CompanyName.TechnologyName
这样,我们看到的名称空间应该是这样的:
Microsoft.Office
PowerSoft.PowerBuilder
注意:这只是一个原则。第三方公司可以选择其它的名字。
避免用公司名称或其它著名品牌的名称作为名称空间的前缀,这样会造成两个公布的名称空间有同一个名称的可能性。(例如,将微软提供的Office自动类命名为Microsoft.Office。)
使用Pascal大写方式,用逗号分隔逻辑成分(例如,Microsoft.Office.PowerPoint)。如果你的品牌使用的是非传统大写方式,那么一定要遵循你的品牌所确定使用的大写方式,即使这种方式背离了通常的名称空间大写规则(例如,NeXT.WebObjects,和ee.cummings。)
中国3S吧 3s8.cn
该用复数的时候要使用复数的名称空间名。例如,使用System.Collections而不是System.Collection。本规则的特例是品牌名称和缩写。例如:使用System.IO而不是System.IOs。
名称空间和类不能使用同样的名字。例如,有一个类被命名为Debug后,就不要再使用Debug作为一个名称空间名。
