ParameterInfo.IsOptional Property

May 11, 2014

Gets a value indicating whether this parameter is optional.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public bool IsOptional { get; }

Property Value

Type: System.Boolean
true if the parameter is optional; otherwise, false.

This method depends on an optional metadata flag. This flag can be inserted by compilers, but compilers are not obligated to do so.

This method uses the Optional member of the ParameterAttributes enumeration.

To get the ParameterInfo array, first get the method, and then call MethodBase.GetParameters.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2014 Microsoft