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

Code Inspection: Introduce optional parameters (private accessibility)

Last modified: 21 March 2024

If the single purpose of an overloaded function is to call the 'implementation' function with default values for some arguments, optional arguments (introduced in C# 4.0) can be used in the 'implementation' function instead of this overload.

JetBrains Rider helps you detect such overloads and automatically remove them, making the corresponding parameters of the 'implementation' functions optional.

Here is an example of a quick-fix suggested by this inspection: