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# "Constant Objects" to use as default parameters

Is there any way to create a constant object(ie it cannot be edited and is created at compile time)? …

c# constants optional-parameters
Named and optional parameters, and WCF

so .Net 4 added named and optional parameters which are pretty sweet. I don't need to make as many 1 line overload …

.net wcf .net-4.0 optional-parameters named-parameters
Is it possible to specify an empty std::vector as a default parameter?

I have been reading through this similar question and find myself less than satisfied with the responses. I don't have …

c++ optional-parameters
How to use default parameters in C#?

In other languages I can set up the method signature like cookEgg(boolean hardBoiled = true) This defaults the parameter hardboiled …

c# .net parameters default-value optional-parameters
C# - Calling a struct constructor that has all defaulted parameters

I ran into this issue today when creating a struct to hold a bunch of data. Here is an example: …

c# struct optional-parameters default-constructor
How to skip optional parameters in C#?

Example: public int foo(int x, int optionalY = 1, int optionalZ = 2) { ... } I'd like to call it like this: int returnVal = foo(5,,8); …

c# optional-parameters
Parameter Action<T1, T2, T3> in which T3 can be optional

I have the following code: public static MyMethod() { ...Do something ProtectedMethod(param1, param2); ...Do something } protected static void ProtectedMethod(IEnumerable&…

c# oop delegates optional-parameters
Mutually exclusive powershell parameters

SCENARIO I'm writing a cmdlet for Powershell 2.0 using Visual Studio 2008 and .NET 3.5 the cmdlet requires 3 arguments. my intended grammar of …

powershell parameters optional-parameters
Which parameter set has been used?

I've used advanced parameter handling to support multiple parameter sets. Is there any pre-defined variable or way to determine which …

powershell parameters optional-parameters
Optional parameters in managed C++/CLI methods

How can I declare a managed method in C++/CLI that has an optional parameter when used from C#? I've …

c# .net c++-cli optional-parameters