Class SerializableDictionary<TKey, TValue>
A dictionary class that can be serialized by Unity. Inspired by the implementation in http://answers.unity3d.com/answers/809221/view.html
Implements
IDictionary<TKey, TValue>
ICollection<KeyValuePair<TKey, TValue>>
IReadOnlyDictionary<TKey, TValue>
IReadOnlyCollection<KeyValuePair<TKey, TValue>>
IEnumerable<KeyValuePair<TKey, TValue>>
Inherited Members
Namespace: Unity.XR.CoreUtils.Collections
Assembly: Unity.XR.CoreUtils.dll
Syntax
[Serializable]
public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IEnumerable, IDeserializationCallback, ISerializable, ISerializationCallbackReceiver
Type Parameters
Name | Description |
---|---|
TKey | The dictionary key. |
TValue | The dictionary value. |
Constructors
SerializableDictionary()
Initializes a new instance of the dictionary.
Declaration
public SerializableDictionary()
SerializableDictionary(IDictionary<TKey, TValue>)
Initializes a new instance of the dictionary that contains elements copied from the given
input
dictionary.
Declaration
public SerializableDictionary(IDictionary<TKey, TValue> input)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<TKey, TValue> | input | The dictionary from which to copy the elements. |
Properties
SerializedItems
The serialized items in this dictionary.
Declaration
public List<SerializableDictionary<TKey, TValue>.Item> SerializedItems { get; }
Property Value
Type | Description |
---|---|
List<SerializableDictionary<TKey, TValue>.Item> |
Methods
OnAfterDeserialize()
See ISerializationCallbackReceiver Load this dictionary from the SerializedItems list.
Declaration
public virtual void OnAfterDeserialize()
OnBeforeSerialize()
See ISerializationCallbackReceiver Save this dictionary to the SerializedItems list.
Declaration
public virtual void OnBeforeSerialize()