Member Declaration

CodeRush Classics includes multiple templates for quick member declaration. They are available inside a class body, but outside methods and properties. A member declaration template usually consists of two parts. The first part is a template proper, the second part is the type variable mnemonic. Such templates look like x?Type? on the Templates options page.

Member Declaration Templates

Member Template
Field(local, parameter) f
Read-only field q
Method m
Property p
Auto-implemented property a
Read-only property r
Write-only property w

Use upper-case letters to declare a static member.

Type Variables

The Type variable lists type mnemonics. Type a member declaration template followed by the desired type mnemonic to use the type in the template expansion. For example to declare a method returning string, use the ms template that consists of the m template proper and the s type mnemonic corresponding to the System.String type.

You can add or remove variables and mnemonics via the Dynamic Lists options page. Here is a step-by-step description of the alternative and an easier way of a custom type mnemonic creation.

  • Right click the reference to the desired type in the code editor and choose Use Type in Templates from the context menu.

    UseTypeInTemplates

  • Specify the type mnemonic via the Use Type in Templates window.

    UseTypeInTemplatesWindow

  • The added type appears in the Custom Types dynamic list.

    CustomTypesList

The following table lists the main System type mnemonics. To access the full list of available type mnemonics, see the Dynamic Lists options page.

Type Mnemonic
Boolean b
Byte by
Char c
DateTime d8
Decimal de
Double d
EventArgs ea
Exception x
Guid g
Int16 sh
Int32 i
Int64 l
IntPtr ip
Object o
Single si
String s
Type ty
UInt32 u