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
tTypeThe target type.
converterICValueConverterThe CValue converter.
overwriteboolTrue 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
converterICValueConverter<T>The CValue converter.
overwriteboolTrue to overwrite the existing converter.
Type Parameters
TThe target type.
Convert(CValue?)
Convert a CValue to a convrete C# type.
public bool Convert(CValue? value)
Parameters
valueCValueThe 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
valueCValueThe CValue to convert.
Returns
- T
The concrete value.
Type Parameters
TThe target type.
Exceptions
- Exception
When the type converter fails.