Search Results for

    Show / Hide Table of Contents

    Interface IValueConverter

    The base interface for a value converter for use by objects generated by Generated<T>(Config, Boolean).

    Namespace: IPA.Config.Stores
    Assembly: IPA.Loader.dll
    Syntax
    public interface IValueConverter
    Remarks

    The object returned from FromValue(Value, Object), if fed into ToValue(Object, Object), should return equivalent Value structures. Similarly, if the result of ToValue(Object, Object) is fed into FromValue(Value, Object), the resulting object should be equivalent to the one passed to ToValue(Object, Object).

    The parent parameter to ToValue(Object, Object) and FromValue(Value, Object) should be (ideally) the the top of the serialization tree, or some other generated object in that tree, rather than some arbitrary object in the middle that is not managed by the generatd config system.

    Converters do not need to perform null checks, as the serializer and deserializer will do that automatically.

    Properties

    | Improve this Doc View Source

    Type

    Gets the type that this IValueConverter handles.

    Declaration
    Type Type { get; }
    Property Value
    Type Description
    System.Type

    Methods

    | Improve this Doc View Source

    FromValue(Value, Object)

    Converts the given Value to the object type handled by this converter.

    Declaration
    object FromValue(Value value, object parent)
    Parameters
    Type Name Description
    Value value

    the Value to deserialize

    System.Object parent

    the object that will own the result

    Returns
    Type Description
    System.Object

    the deserialized object

    | Improve this Doc View Source

    ToValue(Object, Object)

    Converts the given object to a Value.

    Declaration
    Value ToValue(object obj, object parent)
    Parameters
    Type Name Description
    System.Object obj

    the object to convert

    System.Object parent

    the owning object of obj

    Returns
    Type Description
    Value

    a representation of obj as a Value structure

    Extension Methods

    ReflectionUtil.SetField<T, U>(T, String, U)
    ReflectionUtil.GetField<U, T>(T, String)
    ReflectionUtil.SetProperty<T, U>(T, String, U)
    ReflectionUtil.GetProperty<U, T>(T, String)
    ReflectionUtil.InvokeMethod<U, T>(T, String, Object[])
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX