Skip to main content
A newer version of this page is available. .

Members Declaration

  • 2 minutes to read

Templates library includes multiple templates for quick member declaration. These templates are available when the caret is inside a class body, but outside methods and properties. Most member declaration templates are complex and consist of two parts — the kind of member and its type. The table below shows examples of member declaration templates.

Member Kind void Boolean Integer Double String Object
Method m mb mi md ms mo
Property pb pi pd ps po
Auto-implemented Property ab ai ad as ao
Field fb fi fd fs fo

The full list of member declaration templates is available in the code templates configuration options.

NOTE

If you need to force the creation of a static member, Uppercase the first letter of the required template. For example, the "Ms" template creates the static method that returns a string. To access the full list of types or add a new one, refer to the Editor | All Languages | Template Name Variables options page.

The following tables list the main types you can use in templates.

System

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

Generic Collections - one parameter

Type Mnemonic
BindingList bl
Collection c
Comparer cmp
EqualityComparer ec
ICollection ic
IEnumerable ie
LinkedList ll
LinkedListNode lln
List l
Queue q
ReadOnlyCollection roc
Stack k
XPCollection xcl

Generic Collections - two parameters

Type Mnemonic
Dictionary d
KeyValuePair kvp
SortedDictionary sd
SortedList sl

System.Data

Type Mnemonic
DataRow dr
DataRowView drv
DataSet ds
DataTable dt
DataView dv
NOTE

You can see more templates in the CodeRush Cheat Sheet page.

To access the full list of types or add a new one, refer to the Editor | All Languages | Template Name Variables options page.

See Also