Skip to content

TomlTypeConverter Class

Serializer/deserializer used by the config system.

C#
public static class TomlTypeConverter

Inheritance object

Convert object of a given type to a string using available converters.

C#
public static string ConvertToString(object value, Type valueType)

value object

valueType Type

string

Convert string to an object of a given type using available converters.

C#
public static T ConvertToValue<T>(string value)

value string

T

Convert string to an object of a given type using available converters.

C#
public static object ConvertToValue(string value, Type valueType)

value string

valueType Type

object

Get a converter for a given type if there is any.

C#
public static TypeConverter GetConverter(Type valueType)

valueType Type

TypeConverter

Add a new type converter for a given type. If a different converter is already added, this call is ignored and false is returned.

C#
public static bool AddConverter(Type type, TypeConverter converter)

type Type

converter TypeConverter

bool

Check if a given type can be converted to and from string.

C#
public static bool CanConvert(Type type)

type Type

bool

Give a list of types with registered converters.

C#
public static IEnumerable<Type> GetSupportedTypes()

IEnumerable<Type>