public static byte[] Serialize(object obj, Baseline <byte> baseline) { CompositeBinarySerializer serializer = GetSerializer(obj.GetType()); if (!baseline.HasValues) { baseline.CreateValues(serializer.Count); } using (BinaryDataWriter writer = new BinaryDataWriter()) { serializer.Serialize(obj, writer, baseline); return(writer.GetData()); } }