Back
Close

Optional parameters in C#

gpeipman
52.8K views

Optional parameters

C# supports optional parameters when working with methods. Optional are parameters that have default value specified like shown in the following example. It is convenient way to write methods that have default values specified for their arguments.

Optional parameters must be the last ones in method arguments list.

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io