C# Optional Parameters in Library Code

added by BlackWasp
1/20/2013 3:07:43 AM

3 Kicks, 353 Views

C# optional parameters provide a handy way to create methods that can be called with a varying number of arguments but without the need to create overloaded versions. However, the way that they are used in referenced libraries can cause problems.


1 comments

tom103
1/23/2013 3:59:06 PM
Strictly speaking, it's not .NET 4 that introduced optional parameters, but C# 4. Optional parameters were already supported in VB.NET, and the OptionalAttribute that is applied to optional parameters exists since .NET 1.0.