NDesk.Options

GIT Repository

NDesk.Options : NDesk.Options Namespace

OptionException Class

Represents the error that occurs when there is an error parsing an NDesk.Options.Option.

public class OptionException : Exception


Remarks

Instances of this class are thrown when:

Members

See Also: Inherited members from Exception.

Constructors

Creates and initializes a new instance of the NDesk.Options.OptionException class.
Creates and initializes a new instance of the NDesk.Options.OptionException class.

Protected Constructors

Properties

OptionName [read-only]
string . A string containing the option name that caused the exception.

Methods

Member Details

OptionException Constructor

Initializes a new instance of the NDesk.Options.OptionException class with serialized data.

See Also

Parameters

info
The System.Runtime.Serialization.SerializationInfo that holds the serialized object data about the exception being thrown.
context
The System.Runtime.Serialization.StreamingContext that contains contextual information about the source or destination.

Remarks

This constructor is called during deserialization to reconstitute the exception object transmitted over a stream, e.g. from Remoting.

Required Assembly Versions:

  • NDesk.Options 2.0.0.0
  • NDesk.Options 3.5.0.0

OptionException Constructor

public OptionException (string message, string optionName)

Creates and initializes a new instance of the NDesk.Options.OptionException class.

Parameters

message
A string that describes the error.
optionName
A string that contains the name of the option that caused the exception.

Remarks

This constructor initializes the Exception.Message property of the new instance using message, and the OptionException.OptionName property of the new instance using optionName.

Required Assembly Versions:

  • NDesk.Options 2.0.0.0
  • NDesk.Options 3.5.0.0

OptionException Constructor

public OptionException (string message, string optionName, Exception innerException)

Creates and initializes a new instance of the NDesk.Options.OptionException class.

Parameters

message
A string that describes the error.
optionName
A string that contains the name of the option that caused the exception.
innerException
An instance of Exception that is the cause of the current exception. If innerException is non-null, then the current Exception was raised in a catch block handling innerException.

Remarks

This constructor initializes the Exception.Message property of the new instance using message, the Exception.InnerException property of the new instance using innerException, and the OptionException.OptionName property of the new instance using optionName.

Required Assembly Versions:

  • NDesk.Options 2.0.0.0
  • NDesk.Options 3.5.0.0

GetObjectData Method

Adds information about the exception to the provided System.Runtime.Serialization.SerializationInfo instance.

See Also

Parameters

info
The System.Runtime.Serialization.SerializationInfo that holds the serialized object data about the exception being thrown.
context
The System.Runtime.Serialization.StreamingContext that contains contextual information about the source or destination.

Remarks

Adds information about this exception instance to the provided System.Runtime.Serialization.SerializationInfo, so that a new cloned instance may be properly reconstituted later.

Required Assembly Versions:

  • NDesk.Options 2.0.0.0
  • NDesk.Options 3.5.0.0

OptionName Property

public string OptionName { get; }

A string containing the option name that caused the exception.

Value

A string containing the option name that caused the exception.

Remarks

Required Assembly Versions:

  • NDesk.Options 2.0.0.0
  • NDesk.Options 3.5.0.0