Class ArgumentMetadata
- Assembly
- McMaster.Extensions.CommandLineUtils.dll
Metadata about a command argument, extracted at compile time or via reflection.
public sealed class ArgumentMetadata
- Inheritance
-
objectArgumentMetadata
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
propertyNamestringThe name of the property this argument maps to.
propertyTypeTypeThe CLR type of the property.
orderintThe order in which the argument is expected.
getterFunc<object, object>Delegate to get the property value from a model instance.
setterAction<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
Description
A description of the argument.
public string? Description { get; init; }
Property Value
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
Name
The name of the argument.
public string? Name { get; init; }
Property Value
Order
The order in which the argument is expected, relative to other arguments.
public int Order { get; }
Property Value
PropertyName
The name of the property this argument maps to.
public string PropertyName { get; }
Property Value
PropertyType
The CLR type of the property.
public Type PropertyType { get; }
Property Value
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
Validators
Validation attributes applied to this argument.
public IReadOnlyList<ValidationAttribute> Validators { get; init; }
Property Value
- IReadOnlyList<ValidationAttribute>