Jason Vogel
Mar 24, 2022

--

I've been using optional parameters for decades (Oracle PL/SQL). Thankfully later in C#. My argument in favor of them is to reduce copy-paste functions created under the guise of polymorphism (function overloading).

f1(arg1, arg2,arg3)

{ do work }

f1(arg1,arg2)

{ f1(arg1,arg2,'z')

f1(arg1)

{f1(arg1,'y')

instead use to replace all 3...

f1((arg1,arg2='y',arg3='z')

{ do work }

Cleaner, less to maintain, ... But, I understand your points. It is an opinion thing. I really appreciate using them in the (what I think) is the right situation.

--

--