Class TomlTypeConverter

Serializer/deserializer used by the config system.

Inheritance
System.Object TomlTypeConverter
Inherited Members
System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone()
Namespace: BepInEx.Configuration
Assembly: BepInEx.Core.dll
Syntax
public static class TomlTypeConverter

Methods

AddConverter(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.

Declaration
public static bool AddConverter(Type type, TypeConverter converter)
Parameters
Type Name Description
System.Type type
TypeConverter converter
Returns
Type Description
System.Boolean

CanConvert(Type)

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

Declaration
public static bool CanConvert(Type type)
Parameters
Type Name Description
System.Type type
Returns
Type Description
System.Boolean

ConvertToString(Object, Type)

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

Declaration
public static string ConvertToString(object value, Type valueType)
Parameters
Type Name Description
System.Object value
System.Type valueType
Returns
Type Description
System.String

ConvertToValue(String, Type)

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

Declaration
public static object ConvertToValue(string value, Type valueType)
Parameters
Type Name Description
System.String value
System.Type valueType
Returns
Type Description
System.Object

ConvertToValue<T>(String)

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

Declaration
public static T ConvertToValue<T>(string value)
Parameters
Type Name Description
System.String value
Returns
Type Description
T
Type Parameters
Name Description
T

GetConverter(Type)

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

Declaration
public static TypeConverter GetConverter(Type valueType)
Parameters
Type Name Description
System.Type valueType
Returns
Type Description
TypeConverter

GetSupportedTypes()

Give a list of types with registered converters.

Declaration
public static IEnumerable<Type> GetSupportedTypes()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.Type>