Supported Argument Types#
Arguments can be defined with any type that...
- is a primitive type:
- contains a string constructor
- has a TypeConverter
- has a
public static Parse(string)method
Includes, but not limited to:
List<T>, etc.) where T can be converted from string.
There can be only one
List operand in the method, where
List is any type of
List operands must be the last operand defined for the method.
Adding support for other types#
Options for supporting other types
- If you control the type, consider adding a constructor with a single string parameter.
- Create a TypeConverter for your type
- Create a type descriptor
Type descriptors are your best choice when you need
- to override an existing TypeConverter
- conditional logic based on argument metadata (custom attributes, etc)
- the converter only for parsing parameters and not the business logic of your application