Table of Contents

Class Argument

Namespace
OneImlx.Terminal.Commands
Assembly
OneImlx.Terminal.dll

The Argument class is a runtime validated representation of an actual command argument and its value passed by a user or an application.

public sealed class Argument : IEquatable<Argument?>, IKeyAsId, IValue
Inheritance
Argument
Implements
Inherited Members

Remarks

An argument id is always unique within a command. By design Argument implements the default equality IEquatable<T> and GetHashCode() using Id property. Thus, two arguments with the same id are equal irrespective of other property values. This is done to improve performance during lookup and avoid multiple arguments with same identifiers.

The arguments can have same ids across multiple commands. Each Command has ArgumentDescriptors collection that contains attributes with unique ids.

Constructors

Argument(ArgumentDescriptor, object)

Initialize a new instance..

public Argument(ArgumentDescriptor argumentDescriptor, object value)

Parameters

argumentDescriptor ArgumentDescriptor

The argument descriptor.

value object

The argument value.

Properties

DataType

The option data type.

[JsonIgnore]
public string DataType { get; }

Property Value

string

Descriptor

The argument descriptor.

[JsonPropertyName("descriptor")]
public ArgumentDescriptor Descriptor { get; }

Property Value

ArgumentDescriptor

Id

The argument id.

[JsonIgnore]
public string Id { get; }

Property Value

string

Remarks

The argument id is unique with in a command.

Value

The argument value.

[JsonPropertyName("value")]
public object Value { get; set; }

Property Value

object

Methods

ChangeValueType(Type)

Changes the argument value to the specified type.

public void ChangeValueType(Type type)

Parameters

type Type

The new type to use.

Equals(Argument?)

Indicates whether the current argument is equal to another argument.

public bool Equals(Argument? other)

Parameters

other Argument

The other argument.

Returns

bool

true if the current argument is equal to the other argument; otherwise, false.

Equals(object?)

Indicates whether the current argument is equal to another argument.

public override bool Equals(object? obj)

Parameters

obj object

The other argument.

Returns

bool

true if the current argument is equal to the other argument; otherwise, false.

GetHashCode()

Returns the hash code for this argument.

public override int GetHashCode()

Returns

int

Operators

operator ==(Argument?, Argument?)

Indicates whether the current argument is equal to another argument.

public static bool operator ==(Argument? left, Argument? right)

Parameters

left Argument

The left argument.

right Argument

The right argument.

Returns

bool

true if the current argument is equal to the other argument; otherwise, false.

operator !=(Argument?, Argument?)

Indicates whether the current argument is not equal to another argument.

public static bool operator !=(Argument? left, Argument? right)

Parameters

left Argument

The left argument.

right Argument

The right argument.

Returns

bool

true if the current argument is not equal to the other argument; otherwise, false.

See Also