Wiki > SerializableDictionary

SerializableDictionaryBase class


Base class that most be inhertied by any dictionary that wants to be implemented.

Namespace: RotaryHeart.Lib.SerializableDictionary
Package: Serializable Dictionary

Syntax


[System.Serializable]
public class SerializableDictionaryBase<TKey, TValue> : DrawableDictionary, IDictionary<TKey, TValue>, UnityEngine.ISerializationCallbackReceiver

Classes


Accessibility Level Name Description
private DrawableDictionary This class is only used to be able to draw the custom property drawer.

Properties


Accessibility Level Type Name Description
private Dictionary<TKey, TValue> _dict The dictionary where the data is going to be saved.
private TKey[] _keyValues Array of keys used only on UnityEditor, this is used to prevent duplicate keys.
private TKey[] _keys Array of keys used to create the dictionary.
private TValue[] _values Array of values used to create the dictionary.

Methods


Accessibility Level Type Name Description
public Dictionary<TKey, TValue> Clone() Returns a copy of the dictionary.
public void ContainsValue(TKey) Returns true if the value exists; otherwise, false.
public void CopyFrom(IDictionary<TKey, TValue>) Copies the data from a dictionary. If an entry with the same key is found it replaces the value.
public void CopyFrom(object) Copies the data from a dictionary. If an entry with the same key is found it replaces the value. Note that if the src is not a dictionary of the same type it will not be copied.
public void CopyTo(IDictionary<TKey, TValue>) Copies the data to a dictionary. If an entry with the same key is found it replaces the value.
private void OnAfterDeserialize() Called by Unity, initialize the dictionary and adds the elements.
private void OnBeforeSerialize() Called by Unity, sets the dictionary elements back to the array to be displayed on the inspector.

See also