Generating Code from Usage
ReSharper lets you use code symbols ( classes, methods, variables, properties, fields, etc.) before you declare them. When ReSharper detects an undeclared symbol, it suggests one or more quick-fixes for generating the corresponding symbol based on the usage, and then smartly adjust the declaration according to the usage context:
For example, if you create a method from usage, ReSharper will not only create a method,
but also detect its return type and types of its parameters:
Depending on your settings,
in the bodies of generated implementations ReSharper throws new
NotImplementedException(), returns default value,
or puts code that will not compile.
You can configure your preferences on the
page of ReSharper options.
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.