Top "Optional-parameters" questions

An optional parameter is one that a caller can include in a call to a function or method, but doesn't have to.

C# 4.0 - How to Handle Optional String Parameters

This code is not valid: private void Foo(string optionalString = string.Empty) { // do foo. } But this code is: private void …

c# .net string c#-4.0 optional-parameters
Optional parameters for interfaces

Using c# 4.0 -- building an interface and a class that implements the interface. I want to declare an optional parameter …

c# interface c#-4.0 optional-parameters
C# 4.0: Can I use a TimeSpan as an optional parameter with a default value?

Both of these generate an error saying they must be a compile-time constant: void Foo(TimeSpan span = TimeSpan.FromSeconds(2.0)) void …

c# c#-4.0 default-value timespan optional-parameters
Why is the empty dictionary a dangerous default value in Python?

I put a dict as the default value for an optional argument to a Python function, and pylint (using Sublime …

python optional-parameters pylint optional-arguments
Cannot use String.Empty as a default value for an optional parameter

I am reading Effective C# by Bill Wagner. In Item 14 - Minimize Duplicate Initialization Logic, he shows the following example …

c# c#-4.0 optional-parameters
Dynamic or Conditional display of Jenkins job's parameters (rather than their value population)

Let's say I have two(or more) types of projects: app(Application) and svc (Service) and I have created a …

jenkins parameters conditional jenkins-plugins optional-parameters
A javascript design pattern for options with default values?

// opt_options is optional function foo(a, b, opt_options) { // opt_c, opt_d, and opt_e are read from …

javascript design-patterns option optional-parameters
WCF and optional parameters

I just started using WCF with REST and UriTemplates. Is it now possible to use optional parameters? If not, what …

.net wcf rest optional-parameters
C# 4.0: Can I use a Color as an optional parameter with a default value?

public void log(String msg, Color c = Color.black) { loggerText.ForeColor = c; loggerText.AppendText("\n" + msg); } This results in an …

c# optional-parameters
How does one make an optional closure in swift?

I'm trying to declare an argument in Swift that takes an optional closure. The function I have declared looks like …

swift optional-parameters