public static byte[] SerializeToBytes(AddressBook instance) { using (var ms = new MemoryStream()) { Serialize(ms, instance); return ms.ToArray(); } }