CommandAttribute Class

Attribute that indicates a class implementing the ICommand interface is a subcommand.

Definition

Namespace: Ookii.CommandLine.Commands
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public sealed class CommandAttribute : Attribute
Inheritance
Object    Attribute    CommandAttribute

Remarks

To be considered a subcommand, a class must both implement the ICommand interface and have the CommandAttribute attribute applied. This allows classes that implement the ICommand interface, but do not have the attribute, to be used as common base classes for other commands, without being commands themselves.

If a command does not have an explicit name, its name is determined by taking the type name of the command class and applying the transformation specified by the CommandOptionsCommandNameTransform property.

Alternative names for a command can be given by using the AliasAttribute attribute.

Constructors

CommandAttribute Initializes a new instance of the CommandAttribute class using the target's type name as the command name.
CommandAttribute(String) Initializes a new instance of the CommandAttribute class using the specified command name.

Properties

CommandName Gets the name of the command, which can be used to invoke the command or to retrieve it using the CommandManagerGetCommand(String) method.
IsHidden Gets or sets a value that indicates whether the command is hidden from the usage help.
TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(Inherited from Attribute)

Methods

EqualsReturns a value that indicates whether this instance is equal to a specified object.
(Inherited from Attribute)
GetHashCodeReturns the hash code for this instance.
(Inherited from Attribute)
GetTypeGets the Type of the current instance.
(Inherited from Object)
IsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Inherited from Attribute)
MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Inherited from Attribute)
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also