Class CValueConverter
- Namespace
- ReFuel.CVarScript
- Assembly
- ReFuel.dll
Helper class that converts raw CValues to concrete C# types.
public sealed class CValueConverter : ICValueConverter<bool>, ICValueConverter<int>, ICValueConverter<float>, ICValueConverter
- Inheritance
-
CValueConverter
- Implements
- Inherited Members
Properties
Instance
Instance of the default converter set.
public static CValueConverter Instance { get; }
Property Value
Methods
AddConverter(Type, ICValueConverter, bool)
Add a global CValue converter.
public static void AddConverter(Type t, ICValueConverter converter, bool overwrite = false)
Parameters
t
TypeThe target type.
converter
ICValueConverterThe CValue converter.
overwrite
boolTrue to overwrite the existing converter.
AddConverter<T>(ICValueConverter<T>, bool)
Add a global CValue converter.
public static void AddConverter<T>(ICValueConverter<T> converter, bool overwrite = false)
Parameters
converter
ICValueConverter<T>The CValue converter.
overwrite
boolTrue to overwrite the existing converter.
Type Parameters
T
The target type.
Convert(CValue?)
Convert a CValue to a convrete C# type.
public bool Convert(CValue? value)
Parameters
value
CValueThe value to convert.
Returns
- bool
The converted value.
Convert<T>(CValue?)
Convert a CValue to a concrete type.
public static T Convert<T>(CValue? value)
Parameters
value
CValueThe CValue to convert.
Returns
- T
The concrete value.
Type Parameters
T
The target type.
Exceptions
- Exception
When the type converter fails.