Defines an interface for custom serialization of Tag objects.
Namespace: MindFusion.Diagramming
Assembly: MindFusion.Diagramming
SyntaxC#
Copy Code
|
|---|
public interface BinarySerializer |
Visual Basic
Copy Code
|
|---|
Public Interface BinarySerializer |
RemarksBinarySerializer was introduced to provide an alternative to the now-deprecated .NET BinaryFormatter. While PersistContext automatically handles primitive types and enums using System.IO.BinaryWriter operations, it historically fell back to BinaryFormatter for complex objects stored in Tag properties and for ControlNode serialization. Implementing this interface allows you to provide serialization logic for your custom types. Assign an implementing object to the BinarySerializer property of PersistContext, and the interface methods will be called while saving to / loading from binary format.
ExampleYou can serialize a struct set as a Tag value like this:
C#
Copy Code
|
|---|
public struct MyCustomData public MyCustomData(int id, string desc) // write the struct fields to the binary stream // reconstruct the struct from the binary stream // now, when you call diagram.SaveToFile(), your |
See Also