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:

This entry was posted in News and Events and tagged . Bookmark the permalink.

3 Responses to ReSharper in Detail: Complete Statement Scenarios

  1. Peter says:

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">