Class ArgumentConverterProvider
Provides a command argument converter.
Namespace: TehGM.Wolfringo.Commands.Parsing
Assembly: Wolfringo.Commands.dll
Syntax
public class ArgumentConverterProvider : IArgumentConverterProvider, IDisposable
Remarks
This default command argument converter provider is designed to match a type to a converter, and automatically handle enums.
Besides enums, all converters simply match the type. If your custom converter uses complex logic in its CanConvert(ParameterInfo) method, please create own provider class, or inherit from this class.
Constructors
| Improve this Doc View SourceArgumentConverterProvider()
Creates default converter provider with default options.
Declaration
public ArgumentConverterProvider()
ArgumentConverterProvider(ArgumentConverterProviderOptions)
Creates default converter provider.
Declaration
public ArgumentConverterProvider(ArgumentConverterProviderOptions options)
Parameters
Type | Name | Description |
---|---|---|
ArgumentConverterProviderOptions | options |
Properties
| Improve this Doc View SourceDisposeConverters
Whether this provider will dispose converters.
Declaration
protected bool DisposeConverters { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
This will be set to true if Options weren't provided to the constructor.
Disposing will happen when Dispose() is called.
Options
Options used by this provider.
Declaration
protected ArgumentConverterProviderOptions Options { get; }
Property Value
Type | Description |
---|---|
ArgumentConverterProviderOptions |
Methods
| Improve this Doc View SourceDispose()
Disposes the provider.
Declaration
public virtual void Dispose()
Remarks
If any of the mapped converters implements IDisposable, it'll also be disposed, unless options were provided via constructor from external source.
GetConverter(ParameterInfo)
Gets a converter for the parameter.
Declaration
public virtual IArgumentConverter GetConverter(ParameterInfo parameter)
Parameters
Type | Name | Description |
---|---|---|
ParameterInfo | parameter | Parameter to convert. |
Returns
Type | Description |
---|---|
IArgumentConverter | A converter for provided parameter. |