Join us for JetBrains .NET Day Online ’23, a free virtual event, on September 26.

RegisterNice find!

Introducing Variables

Introduce variables the way you like!

Tip Screenshot

Struggling with long lines of code? 🙇‍♀️

Existing expressions can easily be assigned to a new variable using the Introduce Variable refactoring. We can either select the expression and invoke Refactor | Introduce Variable or type .var at the end of the expression to invoke the related postfix template. The refactoring also takes repeated occurrences of our expression into account to reduce code duplication.

Of course, inlining a variable is equally easy using the Refactor | Inline Variable refactoring.

Remember to always use meaningful names! 🏷

See Also