ReSharper 10.0 Help

Completion Tips and Tricks

In this topic:

Correcting Length/Count mistyping

ReSharper prevents you from stumbling over mistyped Length/Count properties of arrays/collections. As soon as you erroneously start typing the Count property for a usage of an array, ReSharper will allow you to pick it from the completion list and replace with the Length property, which you probably meant to type.

Completing mistyped Count property for array

In a similar way, it will help you call the Count property on a collection usage when you start typing the Length property by mistake.

Completing mistyped Length property for collection

The correct property will be there as soon as you accept the completion suggestion:

void Foo(int[] array, List<int> collection) { if(array.Length == collection.Count }

Generating equality and flag checks for enumeration types

When you need to compare a value of enum type to one of the members of this enum, just type a dot and then pick the desired enum member in the completion list:

Completing enum members to produce equality/flag checks

ReSharper will generate the comparison for you:

public enum Direction { North, East, South, West } void Turn(Direction whereTo) { if(whereTo == Direction.South }

Creating type parameter from usage in method parameters

When creating generic methods, you can easily add type parameters by typing T for a new parameter and choosing the corresponding item in the completion list

Creating type parameter from usage in method parameters

ReSharper will add a new type parameter to the method declaration and bring you to a position where you can type the name of the type parameter in both its declaration and usage:

Creating type parameter from usage in method parameters

After you finish typing the name, press Enter or Tab to go on typing.

Last modified: 8 January 2016