Telerik® JustCode™ by Progress

Other Templates insert a code snippet related to C#/VB.NET/JavaScript/HTML/CSS/LESS constructs, not covered by the other code template types. For example there are some predefined code templates for C#/VB.NET/JavaScript conditional or other basic statements like if or Console.WriteLine.

To insert a template

Press Alt+End. From the pop-up menu, select the template you want to insert.

Predefined Templates for C#, VB.NET and JavaScript

if (_) { }

Generates a general purpose if statement.

Language

C#

Default acronym

if

Parameters

  • Variable - $1=SELECT_VARIABLE(bool)$ - instance of bool.

Description

  • if ($1=SELECT_VARIABLE(bool)$)

    {

    |

    }

Example

Initial state

Code Template Other if 1 before

Apply template

Code Template Other if 1 after

Using the Tab key you can iterate over the valid bool variables (currently foo and bar) available in scope. In the example, bar is automatically suggested.

if (_) { } else { }

Generates if/else statement.

Language

C#

Default acronym

ifl

Parameters

  • Variable - $1=SELECT_VARIABLE(bool)$ - instance of bool.

Description

  • if ($1=SELECT_VARIABLE(bool)$)

    {

    |

    }

    else

    {

    }

Example

Initial state

Code Template Other if 1 before

Apply template

Code Template Other if 2 after

Using the Tab key you can iterate over the valid bool variables (currently foo and bar) available in scope. In the example, bar is automatically suggested.

try {} catch (Exception _) {}

Generates a try-catch statement.

Language

C#

Default acronym

tx

Parameters

  • Exception Variable - $1=SUGGEST_EXCEPTION_NAME()$ - name of the exception variable.

Description

  • try

    {

    |

    }

    catch (Exception $1=SUGGEST_EXCEPTION_NAME()$)

    {

    }

Example

Apply template

Code Template Other trycatch 1
Console.WriteLine(_)

Inserts Console.WriteLine statement.

Language

C#

Default acronym

cw

Parameters

  • Exception Variable - $1=SELECT_VARIABLE()$ - name of the exception variable.

Description

  • Console.WriteLine($1=SELECT_VARIABLE()$);|

Example

Initial state

Code Template Other Console Write Line 1 before

Apply template

Code Template Other Console Write Line 1 after

Using the Tab key you can iterate over the local variables (currently foo, bar, baz). In the example, baz is automatically suggested.

if (_ == null) { return; }

Inserts if statement for null validation.

Language

C#

Default acronym

ifna

Parameters

  • Variable - $1=SELECT_VARIABLE()$ - name of the variable to test for null.

Description

  • if($1=SELECT_VARIABLE()$ == null)

    {

    return|;

    }

Example

Initial state

Code Template Other Null If Before

Apply template

Code Template Other Null If After

Using the Tab key you can iterate over the local variables.

var _ = Mock.Create<_>()

Inserts mock creation statement.

Language

C#

Default acronym

cm

Parameters

  • Type - $1$ - type to be mocked.
  • Mock name - $2=SUGGEST_FRIENDLY_NAME($1$, mock)$ - the name of the object.

Description

  • var $2=SUGGEST_FRIENDLY_NAME($1$, mock)$ = Mock.Create<$1$>();

Example

Apply template

Code Template Other Create Mock
public _ _ { get; set; }

Inserts property get and set statements.

Language

C#

Default acronym

a

Parameters

  • Type - $1$ - type of the property.
  • Property name - $2$ - the name of the property.

Description

  • public $1$ $2$ { get; set; }

Example

Apply template

Code Template Other Get Set
public _ _ { get { return _; } set { _ = value; } }

Inserts property get and set statements.

Language

C#

Default acronym

p

Parameters

  • Type - $1$ - type of the property.
  • Property name - $2$ - the name of the property.
  • Variable name - $3=SELECT_VARIABLE($1$)$ - the name of the variable.

Description

  • public $1$ $2$

    {

    get

    {

    return $3=SELECT_VARIABLE($1$)$;

    }

    set

    {

    $3$ = value;

    }

    }

Example

Apply template

Code Template Other Get Set 2
class _ { }

Generates a class.

Language

C#

Default acronym

c

Parameters

  • Class name - $1$ - name of the class.

Description

  • class $1$

    {

    |

    }

Example

Apply template

Code Template Other Create Class
struct _ { }

Generates a structure.

Language

C#

Default acronym

s

Parameters

  • Structure name - $1$ - name of the structure.

Description

  • struct $1$

    {

    |

    }

Example

Apply template

Code Template Other Create Struct
enum _ { }

Generates an enumeration.

Language

C#

Default acronym

e

Parameters

  • Enumeration name - $1$ - name of the enumeration.

Description

  • enum $1$

    {

    |

    }

Example

Apply template

Code Template Other Create Enum
interface _ { }

Generates an interface.

Language

C#

Default acronym

i

Parameters

  • Interface name - $1$ - name of the interface.

Description

  • interface $1$

    {

    |

    }

Example

Apply template

Code Template Other Create Interface

Predefined Templates for HTML

<_> </_>

Generates an empty element.

Default acronym

e

Parameters

  • Element tag - $1=SELECT(TAG)$ - tag of the element.

Description

  • <$1=SELECT(TAG)$>|</$1$>

Example

Apply template

Code Template Other HTML element
<_ />

Generates an empty self-closed element.

Default acronym

ec

Parameters

  • Element tag - $1=SELECT(TAG)$ - tag of the element.

Description

  • <$1=SELECT(TAG)$ |/>

Example

Apply template

Code Template Other HTML self closed element
<a href="_"> </a>

Generates a hyperlink element.

Default acronym

a

Parameters

  • Hyperlink - $1$ - the destination of the link.

Description

  • <a href="$1$">|</a>

Example

Apply template

Code Template Other HTML hyperlink element
<script type="_"> </script>

Generates a script element.

Default acronym

sc

Parameters

  • Script Type - $1=SELECT(text/javascript, text/C#, text/VB, text/vbscript, text/ecmascript)$ - the type of the script.

Description

  • <script type="$1=SELECT(text/javascript, text/C#, text/VB, text/vbscript, text/ecmascript)$">|</script>

Example

Apply template

Code Template Other HTML script element
<style type="text/css"> </style>

Generates a style element.

Default acronym

st

Parameters

none

Description

  • <style type="text/css">

    |

    </style>

Example

Apply template

Code Template Other HTML style element

Predefined Templates for CSS

_ { }

Generates a rule.

Default acronym

r

Parameters

  • Name - $1=SELECT(RULE)$ - the name of the rule.

Description

  • $1=SELECT(RULE)$

    {

    |

    }

Example

Apply template

Code Template Other CSS Rule
_: _;

Generates a property declaration.

Default acronym

p

Parameters

  • Name - $1=SELECT(property)$ - the name of the property.
  • Value - $2=SELECT(value)$ - the value of the property.

Description

  • $1=SELECT(property)$: $2=SELECT(value)$;

Example

Apply template

Code Template Other CSS Property

Predefined Templates for LESS

_ { }

Generates a rule.

Default acronym

r

Parameters

  • Name - $1=SELECT(RULE)$ - the name of the rule.

Description

  • $1=SELECT(RULE)$

    {

    |

    }

Example

Apply template

Code Template Other CSS Rule
._ { }

Generates a mixin.

Default acronym

m

Parameters

  • Name - $1=SELECT(mixin)$ - the name of the mixin.

Description

  • .$1=SELECT(mixin)$

    {

    |

    }

Example

Apply template

Code Template Other LESS Mixin
._(_) { }

Generates a mixin with parameters.

Default acronym

mp

Parameters

  • Name - $1=SELECT(mixin)$ - the name of the mixin.
  • Parameters - $2=SELECT(parameter)$ - the definition of the parameters.

Description

  • .$1=SELECT(mixin)$(@$2=SELECT(parameter)$)

    {

    |

    }

Example

Apply template

Code Template Other LESS Mixin with parameters
_: _;

Generates a property declaration.

Default acronym

p

Parameters

  • Name - $1=SELECT(property)$ - the name of the property.
  • Value - $2=SELECT(value)$ - the value of the property.

Description

  • $1=SELECT(property)$: $2=SELECT(value)$;

Example

Apply template

Code Template Other CSS Property
@_: _;

Generates a variable declaration.

Default acronym

v

Parameters

  • Name - $1=SELECT(variable)$ - the name of the variable.
  • Value - $2=SELECT(value)$ - the value of the variable.

Description

  • @$1=SELECT(variable)$: $2=SELECT(value)$;

Example

Apply template

Code Template Other LESS Variable

See Also