CommandParameter

Wraps a ParameterInfo from a command method, providing type metadata and string-to-value conversion via CommandParameterParser.

Definition

Namespace: Paragon.Core.Command Assembly: Paragon.dll

public class CommandParameter

Remarks

CommandParameter instances are created by CommandMethod during construction. Each wraps a single method parameter and provides:

  • Type metadata — The parameter's Type and Name

  • String parsingSetValueFromString() delegates to CommandParameterParser.Parse() to convert a string input to the parameter's expected type

  • Value storage — The parsed value is stored in Value for later use during invocation

The constructor is private. Instances are created via the static Create() factory method.

Quick Lookup

Goal
How

Create from ParameterInfo

CommandParameter.Create(parameterInfo)

Parse a string value

parameter.SetValueFromString("42")

Read the parsed value

parameter.Value

Get parameter type

parameter.Type

Get parameter name

parameter.Name

Properties

Type

The CLR type of the parameter (e.g., typeof(int), typeof(string)).

Name

The parameter name as declared in the method signature.

Value

The parsed value after calling SetValueFromString(). Initially null until a value is parsed.

Methods

Create

Factory method that creates a CommandParameter from a ParameterInfo.

Parameter
Type
Description

parameterInfo

ParameterInfo

The reflected parameter info

Returns: A new CommandParameter wrapping the given parameter.

SetValueFromString

Parses a string input into the parameter's expected type and stores the result in Value.

Parameter
Type
Description

input

string

String representation of the value

Delegates to CommandParameterParser.Parse(Type, input) for conversion.

Common Pitfalls

circle-exclamation
circle-exclamation

Examples

Basic Usage (internal to Command system)

See Also

Last updated