Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

How-To's

ReSharper in Detail: Complete Statement Scenarios

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:

Technorati tags: ReSharper in Detail, ReSharper 4.0, Complete Statement, Code Completion
image description