ConversionAction

References
public abstract class ConversionAction
A non-generic wrapper class around a ConversionDelegate<T, Q>.

Constructors

ConversionAction

#
protected ConversionAction(Type source, Type target, Merit merit, string explanation)
source (Type)
target (Type)
merit (Merit)
explanation (string)

Properties

Derived

#
public bool Derived { get; }
Gets whether this is a derived conversion. Derived conversions are automatically added at runtime by the ConversionServer when a conversion for a less derived type can be found and tweaked to work for a more derived type.

Explanation

#
public string Explanation { get; }
Gets the explanation (if any) attached to the conversion method.

Merit

#
public Merit Merit { get; }
The merit of this conversion step.

SourceType

#
public Type SourceType { get; }
Gets the input type for this conversion.

TargetType

#
public Type TargetType { get; }
Gets the output type for this conversion.

Methods

ConvertWeak

#
public abstract void ConvertWeak(object value, out object result)
Perform the conversion from SourceType to TargetType. This method will throw if the types do not match up, or if the underlying delegate throws. Use the TryConvertWeak(object, object) methods to add proper error handling.
value (object)
result (out object)

TryConvertWeak

#
public bool TryConvertWeak(object source, out object target, out string failure)
Execute the conversion with error handling.
source (object)
target (out object)
failure (out string)

TryConvertWeak

#
public bool TryConvertWeak(object source, out object target)
Execute the conversion with error handling.
source (object)
target (out object)

TryDelegate<TSource, TTarget>

#
public static bool TryDelegate<TSource, TTarget>(ConversionDelegate<TSource, TTarget> method, TSource source, out TTarget target, out Merit merit, out string explanation)
Run a conversion delegate method.
method (ConversionDelegate<TSource, TTarget>)
source (TSource)
target (out TTarget)
merit (out Merit)
explanation (out string)

TryDelegate<TSource, TTarget>

#
public static bool TryDelegate<TSource, TTarget>(ConversionDelegate<TSource, TTarget> method, TSource source, out TTarget target)
Run a conversion delegate method.
method (ConversionDelegate<TSource, TTarget>)
source (TSource)
target (out TTarget)