ASP.NET Pack Programmer's Guide
DiagramItem.SaveTo Method
See Also
 





Serializes the item to the specified writer.

Namespace: MindFusion.Diagramming
Package: MindFusion.Diagramming

 Syntax

C#  Copy Code

protected virtual void SaveTo (
    BinaryWriter writer,
    PersistContext context
)

Visual Basic  Copy Code

Protected Overridable Sub SaveTo( _
    writer As BinaryWriter, _
    context As PersistContext _
)

 Parameters

writer
A BinaryWriter object the item's data should be written to.
context
A PersistContext object providing contextual information about the serialization process and some helper serialization methods.

 Remarks

This method is invoked when an item is being serialized to a binary-format diagram file.

 Example

The following example shows how to implement this method in a derived class.

C#  Copy Code

protected override void SaveTo(System.IO.BinaryWriter writer, PersistContext ctx)
{
    base.SaveTo(writer, ctx);

    // Save the label using the standard .NET BinaryWriter
    writer.Write(label);

    // Save the image using the built-in image saving code,
    // which stores the contents of shared images only once.
    ctx.SaveImage(icon);
}

Visual Basic  Copy Code

Protected Overrides Sub SaveTo(ByVal writer As System.IO.BinaryWriter, ByVal ctx As PersistContext)

    MyBase.SaveTo(writer, ctx)

    ' Save the label using the standard .NET BinaryWriter
    writer.Write(title)

    ' Save the image using the built-in image saving code,
    ' which stores the contents of shared images only once.
    ctx.SaveImage(imgIcon)

End Sub

 See Also

DiagramItem Members
DiagramItem Class
MindFusion.Diagramming Namespace