JetBrains Rider 2024.3 Help

Code inspection: Introduce optional parameters (private accessibility)

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

This inspection reports such overloads and suggests removing them to make the corresponding parameters of the 'implementation' functions optional.

void Foo(object value) { Foo(value, true); } void Foo(object value, bool flag) { //implementation }
void Foo(object value, bool flag = true) { //implementation }
Last modified: 04 June 2024