Introducing Variables

Introduce variables the way you like!

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


Related Resources

Solution-Wide Analysis
Solution-Wide Analysis
Find and resolve code issues in your projects.
Fixing Warnings and Errors
Fixing Warnings and Errors
Automatically resolve inspections using quick fixes.
Exploring Code Analysis Results
Exploring Code Analysis Results
Find code quality issues that matter and need your attention.