protected override void OnDeserialize(System.Runtime.Serialization.IFormatter formatter, System.Runtime.Serialization.SurrogateSelector selector) { FlowchartSerialize surrogate = new FlowchartSerialize(); selector.AddSurrogate(typeof(Flowchart), new StreamingContext(StreamingContextStates.All), surrogate); base.OnDeserialize(formatter, selector); }
static object Deserialize(string location, System.Runtime.Serialization.IFormatter formatter) { using (StreamReader writer = new StreamReader(location)) { return(formatter.Deserialize(writer.BaseStream)); } }
static void Serialize(object targetObject, string location, System.Runtime.Serialization.IFormatter formatter) { using (StreamWriter writer = new StreamWriter(location, false)) { formatter.Serialize(writer.BaseStream, targetObject); writer.Flush(); } }
protected override void OnDeserialize(System.Runtime.Serialization.IFormatter formatter, System.Runtime.Serialization.SurrogateSelector selector) { selector.AddSurrogate(typeof(CustomDiagram), new StreamingContext(StreamingContextStates.All), new CustomDiagramSerialize()); base.OnDeserialize(formatter, selector); }
public static byte[] Serialize <TEntity>(this TEntity entity, Serialization.IFormatter formatter) { if (entity == null) { return(default);