22.3 Word Choice

It's wise to avoid using class names duplicated in heavily used namespaces. For instance, do not use the following for a class name :

 System       Collections   Forms       UI 

Also avoid using identifiers that conflict with common keywords; remember that all keywords must be escapable (and therefore usable) within any .NET language, but that doesn't mean it's easy to do. Avoid the identifier names listed in Table 22-1.

Table 22-1. Common keywords best avoided in class names

AddHandler

AddressOf

Alias

And

Ansi

As

Assembly

Auto

BitAnd

BitNot

BitOr

BitXor

Boolean

ByRef

Byte

ByVal

Call

Case

Catch

CBool

CByte

CChar

CDate

CDec

CDbl

Char

CInt

Class

CLng

CObj

Const

CShort

CSng

CStr

CType

Date

Decimal

Declare

Default

Delegate

Dim

Do

Double

Each

Else

ElseIf

End

Enum

Erase

Error

Eval

Event

Exit

Extends

ExternalSource

False

Finally

For

Friend

Function

Get

GetType

Goto

Handles

If

Implements

Imports

In

Inherits

Integer

Interface

Is

InstanceOf

Let

Lib

Like

Long

Loop

Me

Mod

Module

MustInherit

MustOverride

MyBase

MyClass

Namespace

New

Next

Not

Nothing

NotInheritable

NotOverridable

Object

On

Option

Optional

Or

Overloads

Overridable

Overrides

Package

ParamArray

Preserve

Private

Property

Protected

Public

RaiseEvent

ReadOnly

ReDim

Region

REM

RemoveHandler

Resume

Return

Select

Set

Shadows

Shared

Short

Single

Static

Step

Stop

String

Structure

Sub

SyncLock

Then

Throw

To

True

Try

TypeOf

Unicode

Until

Var

Variant

When

While

With

WithEvents

WriteOnly

Xor

 

Try to avoid using abbreviations in identifiers (including parameter names), but if doing so renders the name more unintelligible, use camel- casing rules for any abbreviation over two characters , even if this is not the standard abbreviation. (Thus, the compound name "XML reader" should be called "XmlReader").



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net