Search Results for

Show / Hide Table of Contents

# Class CollectionConverter<T, TCollection>

A base class for all ICollection<T> type converters, providing most of the functionality.

##### Inheritance

Object
ValueConverter<TCollection>
CollectionConverter<T, TCollection>
CollectionConverter<T, TCollection, TConverter>
IListConverter<T>
ISetConverter<T>
ListConverter<T>

##### Implements

IValueConverter

##### Inherited Members

ValueConverter<TCollection>.IValueConverter.ToValue(Object, Object)
ValueConverter<TCollection>.IValueConverter.FromValue(Value, Object)
ValueConverter<TCollection>.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 class CollectionConverter<T, TCollection> : ValueConverter<TCollection>, IValueConverter where TCollection : ICollection<T>

##### Type Parameters

Name | Description
--- | ---
T | the type of the items in the collection
TCollection | the instantiated type of collection

### Constructors

| Improve this Doc View Source

#### CollectionConverter()

Creates a CollectionConverter<T, TCollection> using the default converter for the element type. Equivalent to calling CollectionConverter(ValueConverter<T>) with Default.

##### Declaration

    public CollectionConverter()

##### See Also

CollectionConverter(ValueConverter<T>)
| Improve this Doc View Source

#### CollectionConverter(ValueConverter<T>)

Creates a CollectionConverter<T, TCollection> using the specified underlying converter.

##### Declaration

    public CollectionConverter(ValueConverter<T> underlying)

##### Parameters

Type | Name | Description
--- | --- | ---
ValueConverter<T> | underlying | the ValueConverter<T> to use to convert the values

### Properties

| Improve this Doc View Source

#### BaseConverter

Gets the converter for the collection's value type.

##### Declaration

    protected ValueConverter<T> BaseConverter { get; }

##### Property Value

Type | Description
--- | ---
ValueConverter<T> |

### Methods

| Improve this Doc View Source

#### Create(Int32, Object)

Creates a collection of type `TCollection` using the `size` and `parent`.

##### Declaration

    protected virtual TCollection Create(int size, object parent)

##### Parameters

Type | Name | Description
--- | --- | ---
Int32 | size | the initial size of the collecion
Object | parent | the object that will own the new collection

##### Returns

Type | Description
--- | ---
TCollection | a new instance of `TCollection`

##### See Also

FromValue(Value, Object)
| Improve this Doc View Source

#### FromValue(Value, Object)

Deserializes a List in `value` into a new `TCollection` owned by `parent`.

##### Declaration

    public override TCollection FromValue(Value value, object parent)

##### Parameters

Type | Name | Description
--- | --- | ---
Value | value | the List to convert to a `TCollection`
Object | parent | the object that will own the resulting `TCollection`

##### Returns

Type | Description
--- | ---
TCollection | a new `TCollection` holding the deserialized content of `value`

##### Overrides

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

##### See Also

FromValue(Value, Object)
| Improve this Doc View Source

#### PopulateFromValue(TCollection, List, Object)

Populates the colleciton `col` with the deserialized values from `list` with the parent `parent`.

##### Declaration

    protected void PopulateFromValue(TCollection col, List list, object parent)

##### Parameters

Type | Name | Description
--- | --- | ---
TCollection | col | the collection to populate
List | list | the values to populate it with
Object | parent | the object that will own the new objects

##### See Also

FromValue(Value, Object)
| Improve this Doc View Source

#### ToValue(TCollection, Object)

Serializes a `TCollection` into a List.

##### Declaration

    public override Value ToValue(TCollection obj, object parent)

##### Parameters

Type | Name | Description
--- | --- | ---
TCollection | obj | the `TCollection` to serialize
Object | parent | the object owning `obj`

##### Returns

Type | Description
--- | ---
Value | the List that `obj` was serialized into

##### Overrides

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

##### See Also

ToValue(T, 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[])