Search Results for

Show / Hide Table of Contents

# Class EnumConverter<T>

A converter for an enum of type `T`, that converts the enum to its string representation and back.

##### Inheritance

Object
ValueConverter<T>
EnumConverter<T>

##### Implements

IValueConverter

##### Inherited Members

ValueConverter<T>.IValueConverter.ToValue(Object, Object)
ValueConverter<T>.IValueConverter.FromValue(Value, Object)
ValueConverter<T>.IValueConverter.Type
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

###### Namespace: IPA.Config.Stores.Converters

###### Assembly: IPA.Loader.dll

##### Syntax

    public sealed class EnumConverter<T> : ValueConverter<T>, IValueConverter where T : Enum

##### Type Parameters

Name | Description
--- | ---
T | the enum type

### Methods

| Improve this Doc View Source

#### FromValue(Value, Object)

Converts a Value that is a Text node to the corresponding enum value.

##### Declaration

    public override T FromValue(Value value, object parent)

##### Parameters

Type | Name | Description
--- | --- | ---
Value | value | the Value to convert
Object | parent | the object which will own the created object

##### Returns

Type | Description
--- | ---
T | the deserialized enum value

##### Overrides

IPA.Config.Stores.ValueConverter<T>.FromValue(IPA.Config.Data.Value, System.Object)

##### Exceptions

Type | Condition
--- | ---
ArgumentException | if `value` is not a Text node

| Improve this Doc View Source

#### ToValue(T, Object)

Converts an enum of type `T` to a Value node corresponding to its value.

##### Declaration

    public override Value ToValue(T obj, object parent)

##### Parameters

Type | Name | Description
--- | --- | ---
T | obj | the value to serialize
Object | parent | the object which owns `obj`

##### Returns

Type | Description
--- | ---
Value | a Text node representing `obj`

##### Overrides

IPA.Config.Stores.ValueConverter<T>.ToValue(T, System.Object)

### Implements

IValueConverter

### 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[])