Home > Code Generation > Code Templates – Comments

Code Templates – Comments

March 10th, 2011

Here is the list of CodeRush comments-specific code templates. The templates below generate comments for code areas, tasks, and a few others (miscellaneous). Nearly all of these templates start with the “/” character (for CSharp) or ” ‘ ” (for Visual Basic). See these comments on the Editor | Templates options page in the Options Dialog.

To better understand template expansions, I recommend familiarizing yourself with a few common text commands that you can observe inside these expansions.

Charp templates:

Template Expansion
Comments\Tasks
/b // BUGBUG: «Caret»
/h // HACK: «Caret»
/t // TODO: «Caret»
.. /* «Caret» */
Comments\Misc
/cod // Create on demand…
/dn // Do nothing. Let descendants override.
/dnt // Do not translate (MLHIDE)
/t // Translate
Comments\Code areas
/c // constructors…
/ci // constructors/initialization…
/d // destructor…
/eh // event handlers…
/et // event triggers…
/f // finalizer…
/ie // internal events…
/if // internal fields…
/im // internal methods…
/ip // internal properties…
/ism // internal static methods…
/ite «:/ie»
/itf «:/if»
/itm «:/im»
/itp «:/ip»
/itvm «:/ivm»
/ivm // internal virtual methods…
/mo // method overrides…
/pbe // public events…
/pbf // public fields…
/pbm // public methods…
/pbo // public method overrides…
/pbp // public properties…
/pbvm // public virtual methods…
/pe // public events…
/pf // public fields…
/pm // public methods…
/pmo «:/pbo»
/pp // public properties…
/psm // public static methods…
/psp // public static properties…
/pte // protected events…
/ptf // protected fields…
/ptm // protected methods…
/pto // protected method overrides…
/ptp // protected properties…
/ptsm // protected static methods…
/ptvm // protected virtual methods…
/pve // private events…
/pvf // private fields…
/pvm // private methods…
/pvp // private properties…
/pvsm // private static methods…
/sc // static constructor…
/sm // static methods…

Show Visual Basic templates… »

Visual Basic templates:

Template Expansion
CommentsTasks
‘b ‘ BUGBUG: «Cursor»
‘t ‘ TODO: «Cursor»
.. «Cursor»
CommentsMisc
‘cod ‘ Create on demand…
‘dn ‘ Do nothing. Let descendants override.
‘dnt ‘ Do not translate
‘t ‘ Translate
CommentsCode areas
‘c ‘ constructors…
‘ci ‘ constructors/initialization…
‘d ‘ destructor…
‘eh ‘ event handlers…
‘et ‘ event triggers…
‘ie ‘ internal events…
‘im ‘ internal methods…
‘ip ‘ internal properties…
‘ism ‘ internal shared methods…
‘ite «:’ie»
‘itf «:’if»
‘itm «:’im»
‘itp «:’ip»
‘itvm «:’ivm»
‘ivm ‘ internal virtual methods…
‘pbe ‘ public events…
‘pbf ‘ public fields…
‘pbm ‘ public methods…
‘pbp ‘ public properties…
‘pbvm ‘ public virtual methods…
‘pf ‘ public fields…
‘pm ‘ public methods…
‘pp ‘ public properties…
‘psm ‘ public shared methods…
‘psp ‘ public shared properties…
‘pte ‘ protected events…
‘ptf ‘ protected fields…
‘ptm ‘ protected methods…
‘pto ‘ protected method overrides…
‘ptp ‘ protected properties…
‘ptsm ‘ protected shared methods…
‘ptvm ‘ protected virtual methods…
‘pve ‘ private events…
‘pvf ‘ private fields…
‘pvm ‘ private methods…
‘pvp ‘ private properties…
‘pvsm ‘ private shared methods…
‘sc ‘ shared constructor…
‘sm ‘ shared methods…
—–
Products: CodeRush Pro
Versions: 10.2 and up
VS IDEs: any
Updated: Mar/10/2011
ID: C080

Similar Posts:

  1. Simon Martin
    March 11th, 2011 at 00:39 | #1

    Just wondering why there was no HACK in the VB templates?

  2. March 11th, 2011 at 01:59 | #2

    @Simon Martin
    Thanks for noticing that! Looks like it is missing by mistake. We will add this template in the next release.

  3. Des Edwards
    March 20th, 2011 at 03:15 | #3

    The keystring for TODO and Translate in VB look as though they are the same – ??

  4. March 21st, 2011 at 08:20 | #4

    @ Des Edwards
    That’s right, the keystring is the same, but the context is different. The ‘TODO’ template expands when you are on empty line, but the ‘translate’ template expands when you are NOT on an empty line. To learn more about the context nature, check the following link.

  5. Des Edwards
    March 21st, 2011 at 22:47 | #5

    thanks 😳

  6. Eriq VanBibber
    March 28th, 2011 at 09:57 | #6

    Not sure where to ask this, but this might work here…

    How can i evaluate a value from <> and return something different in the expansion?

    I have a custom SQL class that decorates properties in my class with an attribute that describes the underlying SqlType for the property.

    For instance…
    [SqlType(SqlDBType.uniqueidentifier)]
    public Guid ThePK
    {
    get { return _thePK; }
    set { _thePK = value; }
    }

    In order to templatize the above, i have tableprop?Type? template, but i want to pickup the ?Type? and for instance, when <> is Guid, set the SqlType to ‘UniqueIdentifier’

    Thanks!

  7. Eriq VanBibber
    March 28th, 2011 at 09:59 | #7

    Shoot! it stripped my stuff! in my prev comment, replace with «?Get(Type)»

  8. March 28th, 2011 at 10:12 | #8

    @ Eriq VanBibber
    Please contact DevExpress technical support for these kinds of questions. They will provide you with a sample on how to achieve the result you want.

  9. Eriq VanBibber
    March 28th, 2011 at 10:14 | #9

    @ Alex Skorkin

    cool! will do, and if i figure it out, i’ll post back!