JetBrains Rider
 
Get JetBrains Rider
Get your hands on the new features ahead of the release by joining the Early Access Program for Rider 2025.1! Learn more

Generate code from usage

Last modified: 25 September 2024

JetBrains Rider lets you use code symbols (classes, methods, variables, properties, fields, and so on) before you declare them. When JetBrains Rider detects an undeclared symbol, it suggests one or more quick-fixes AltEnter 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, JetBrains Rider will not only create a method, but also detect its return type and types of its parameters:

JetBrains Rider: Generating code from usage

For additional examples of how JetBrains Rider creates code symbols from usages, see Undefined variable and Undefined method call samples in the Examples of quick-fixes.