Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Serializable]
public class MyDictionary<K, V> : Dictionary<K, V>
{
public MyDictionary ()
{
}
protected MyDictionary(SerializationInfo info,
StreamingContext context)
{
foreach (var v in (KeyValuePair<K, V>[]) info.GetValue ("contents", typeof (KeyValuePair<K, V>[])))
Add (v.Key, v.Value);
}
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
info.AddValue ("contents", this.ToArray ());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment