public override byte[] ToBinary(object obj) { if (obj is Snapshot) return SnapshotToBinary((obj as Snapshot).Data); throw new ArgumentException(typeof(SnapshotSerializer) + " cannot serialize object of type " + obj.GetType(), "obj"); }