Telerik® JustCode™ by Progress

Surround Templates surround a C#/VB.NET/JavaScript code fragment with a valid language statement.

To insert a template

  1. Select a code fragment you want to surround with a template.
  2. Press Alt+End. From the pop-up menu, select the template you want to insert.

Predefined Surround Templates

{ ... }

Surrounds the selected code fragment with curly brackets.

Language

C#

Description

  • {

    $STATEMENT_SELECTION$|

    }

try { ... } catch(Exception _) { }

Surrounds the selected code fragment with a try/catch statement. The selected code is placed inside the try block.

Language

C#

Parameters

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

Description

  • try

    {

    $STATEMENT_SELECTION$|

    }

    catch (Exception $1=SUGGEST_EXCEPTION_NAME()$)

    {

    }

Example

Initial state

Code Template Surround trycatch 1 before

Apply template

Code Template Surround trycatch 1 after
try { ... } finally { }

Surrounds the selected code fragment with a try/finally statement. The selected code is placed inside the try block.

Language

C#

Description

  • try

    {

    $STATEMENT_SELECTION$|

    }

    finally

    {

    |

    }

Example

Initial state

Code Template Surround trycatch 1 before

Apply template

Code Template Surround Try Finally After
try { ... } catch (Exception _) { } finally { }

Surrounds the selected code fragment with a try/catch/finally statement. The selected code is placed inside the try block.

Language

C#

Parameters

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

Description

  • try

    {

    $STATEMENT_SELECTION$|

    }

    catch (Exception $1=SUGGEST_EXCEPTION_NAME()$)

    {

    }

    finally

    {

    }

Example

Initial state

Code Template Surround trycatch 1 before

Apply template

Code Template Surround Try Catch Finally After
if (_) { ... }

Surrounds the selected code fragment with an if statement.

Language

C#

Parameters

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

Description

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

    {

    $STATEMENT_SELECTION$|

    }

Example

Initial state

Code Template Surround if 1 before

Apply template

Code Template Surround if 1 after

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

if (_) { ... } else { }

Surrounds the selected code fragment with an if-else statement. The selected code is placed inside the if block.

Language

C#

Parameters

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

Description

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

    {

    $STATEMENT_SELECTION$|

    }

    else

    {

    }

Example

Initial state

Code Template Surround if 1 before

Apply template

Code Template Surround ifelse 1 after

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

while (_) { ... }

Surrounds the selected code fragment with a while statement.

Language

C#

Parameters

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

Description

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

    {

    $STATEMENT_SELECTION$|

    }

Example

Initial state

Code Template Surround while 1 before

Apply template

Code Template Surround while 1 after

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

do { ... } while (_)

Surrounds the selected code fragment with a do-while statement. The selected code is placed inside the do block.

Language

C#

Parameters

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

Description

  • do

    {

    $STATEMENT_SELECTION$|

    }while ($1=SELECT_VARIABLE(bool)$)

Example

Initial state

Code Template Surround while 1 before

Apply template

Code Template Surround Do While After

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

using (...) { }

Surrounds the selected code fragment with a using statement.

Language

C#

Parameters

  • Variable - $1$ - name of the variable.

Description

  • using ($1$)

    {

    $STATEMENT_SELECTION$|

    }

C#

Example

Initial state

Code Template Surround Using Before

Apply template

Code Template Surround Using After
namespace _ { ... }

Surrounds the selected code fragment with a namespace statement.

Language

C#

Parameters

  • Name - $1$ - name of the namespace.

Description

  • namespace $1$

    {

    $STATEMENT_SELECTION$|

    }

Example

Initial state

Code Template Surround Namespace Before

Apply template

Code Template Surround Namespace After

See Also