Table of Contents

Class ArgumentMetadata

Namespace
McMaster.Extensions.CommandLineUtils.SourceGeneration
Assembly
McMaster.Extensions.CommandLineUtils.dll

Metadata about a command argument, extracted at compile time or via reflection.

public sealed class ArgumentMetadata
Inheritance
object
ArgumentMetadata

Constructors

ArgumentMetadata(string, Type, int, Func<object, object?>, Action<object, object?>)

Initializes a new instance of the ArgumentMetadata class.

public ArgumentMetadata(string propertyName, Type propertyType, int order, Func<object, object?> getter, Action<object, object?> setter)

Parameters

propertyName string

The name of the property this argument maps to.

propertyType Type

The CLR type of the property.

order int

The order in which the argument is expected.

getter Func<object, object>

Delegate to get the property value from a model instance.

setter Action<object, object>

Delegate to set the property value on a model instance.

Properties

DeclaringType

The type that declares this property.

public Type? DeclaringType { get; init; }

Property Value

Type

Description

A description of the argument.

public string? Description { get; init; }

Property Value

string

Getter

Delegate to get the property value from a model instance.

public Func<object, object?> Getter { get; }

Property Value

Func<object, object>

MultipleValues

Whether this argument accepts multiple values.

public bool MultipleValues { get; init; }

Property Value

bool

Name

The name of the argument.

public string? Name { get; init; }

Property Value

string

Order

The order in which the argument is expected, relative to other arguments.

public int Order { get; }

Property Value

int

PropertyName

The name of the property this argument maps to.

public string PropertyName { get; }

Property Value

string

PropertyType

The CLR type of the property.

public Type PropertyType { get; }

Property Value

Type

Setter

Delegate to set the property value on a model instance.

public Action<object, object?> Setter { get; }

Property Value

Action<object, object>

ShowInHelpText

Whether this argument appears in generated help text.

public bool ShowInHelpText { get; init; }

Property Value

bool

Validators

Validation attributes applied to this argument.

public IReadOnlyList<ValidationAttribute> Validators { get; init; }

Property Value

IReadOnlyList<ValidationAttribute>