Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Naming Warnings
 Avoid type names in parameters

  Switch on low bandwidth view
Visual Studio Team System
Avoid type names in parameters

TypeName

AvoidTypeNamesInParameters

CheckId

CA1720

Category

Microsoft.Naming

Breaking Change

Breaking

The name of a parameter in an externally visible member contains a type name.

Each concatenated word in the parameter name is checked against the following type names, in a case-insensitive manner:

  • bool

  • boolean

  • byte

  • char

  • double

  • float

  • float32

  • float64

  • int

  • int8

  • int16

  • int32

  • int64

  • integer

  • long

  • object

  • sbyte

  • short

  • single

  • string

  • uint

  • uint16

  • uint32

  • uint64

  • ulong

  • unsigned

  • ushort

  • wchar

Parameter names are better used to convey a parameter's meaning than to describe a parameter's type, which is expected to be provided by development tools. If a type name must be used, use a universal type name instead of a language-specific type name. For example, instead of the C# type name 'ushort', use the universal type name, UInt16.

Select a parameter name that does not contain one of the previously listed type names.

Occasional use of type-based parameter names is appropriate, in addition to using words with alternative English meanings such as short and long. Exclude a warning from this rule in these limited cases.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker