internal static byte[] SerializeData(this IGameSerializable obj) { var binaryFormatter = new BinaryFormatter { SurrogateSelector = GetSurrogateSelector() }; using (var memoryStream = new MemoryStream()) { binaryFormatter.Serialize(memoryStream, obj); obj.OnSerialized(); return(memoryStream.ToArray()); } }
public byte[] SerializeData(IGameSerializable obj) { return(obj.SerializeData()); }