ReSharper 2020.1 Help

Generate Code from Usage

ReSharper lets you use code symbols (classes, methods, variables, properties,fields, and so on) before you declare them. When ReSharper detects an undeclared symbol, it suggests one or more quick-fixes Alt+Enter for generating a declaration based on the usage, and then smartly adjust the declaration according to the usage context:

'Generate from usage' quick-fix

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:

ReSharper: Generating code from usage

For additional examples of how ReSharper creates code symbols from usages, see Undefined variable and Undefined method call samples in the Examples of Quick-Fixes.

This feature is supported in the following languages and technologies:

Language: C#Language: VB.NETLanguage: C++Language: HTMLLanguage: ASP.NETLanguage: RazorLanguage: JavaScriptLanguage: TypeScriptLanguage: CSSLanguage: XMLLanguage: XAMLLanguage: ResxLanguage: Build ScriptsLanguage: ProtobufLanguage: JSON

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.

Last modified: 14 July 2020