ReSharper in Detail: Complete Statement Scenarios

Posted on by Jura Gorohovsky

As you might already know, Complete Statement (Ctrl+Shift+Enter) is one of major enhancements in Code Completion brought by ReSharper 4.0. This feature inserts necessary syntax elements to complete the current statement or another language construct, and gets you in position to write your code further.

Complete Statement is currently known to work with the following language constructs:

  • Type members: class, interface, struct, enum, delegate, field, event, and method declarations;
  • Statements: if, while, do, switch, using, lock, continue, break, and return statements; case and default clauses; conversion of single-line statements to block statements;
  • Expressions: invocation, element access, string/char literals; object, member, and collection item initializers; expressions that create anonymous types and implicitly typed arrays.

Below are a number of specific examples of the assistance that Complete Statement provides in specific contexts.

Class declaration

Before Complete Statement:

After Complete Statement:

Delegate declaration

Before Complete Statement:

After Complete Statement:

Method declaration

Before Complete Statement:

After Complete Statement:

Nested method invocation

Before Complete Statement:

After Complete Statement:

if statement

Before Complete Statement:

After Complete Statement:

case clause

Before Complete Statement:

After Complete Statement:

Conversion of a single-line statement into block

Before Complete Statement:

After Complete Statement:

Element access expression

Before Complete Statement:

After Complete Statement:

Comments below can no longer be edited.

3 Responses to ReSharper in Detail: Complete Statement Scenarios

  1. Ted Jardine says:

    May 17, 2008

    Love it.

  2. Peter says:

    November 9, 2011

    It is sweet! But why have you left out support for class-level const declarations?

  3. Jura Gorohovsky says:

    November 11, 2011

    @Peter Have we? This looks like a bug. Can you please report it in the bug tracker? Thank you

Subscribe

Subscribe to .NET Tools updates