VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Annotation.Formatters Namespace / AnnotationSerializationBinder Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
AnnotationSerializationBinder Class
In This Topic
Allows user to control the annotation loading process and select the annotation to load.
Object Model
AnnotationSerializationBinder AnnotationSerializationBinder AnnotationSerializationBinder
Syntax
'Declaration

Public Class AnnotationSerializationBinder
   Inherits System.Runtime.Serialization.SerializationBinder

public class AnnotationSerializationBinder : System.Runtime.Serialization.SerializationBinder

Example

Here is an example that shows how to create custom serialization binder for custom annotation:


Public Class CustomAnnotationSerializationBinder
    Inherits Vintasoft.Imaging.Annotation.Formatters.AnnotationSerializationBinder

    Public Sub New()
        MyBase.New()
    End Sub


    Public Overrides Function BindToType(assemblyName As String, typeName As String) As System.Type
        If typeName = "AnnotationDemo.TriangleAnnotation" Then
            typeName = "AnnotationDemo.TriangleAnnotationData"
        End If

        Return MyBase.BindToType(assemblyName, typeName)
    End Function

End Class


public class CustomAnnotationSerializationBinder : 
    Vintasoft.Imaging.Annotation.Formatters.AnnotationSerializationBinder
{

    public CustomAnnotationSerializationBinder()
        : base()
    {
    }


    public override System.Type BindToType(string assemblyName, string typeName)
    {
        if (typeName == "AnnotationDemo.TriangleAnnotation")
            typeName = "AnnotationDemo.TriangleAnnotationData";

        return base.BindToType(assemblyName, typeName);
    }

}

Inheritance Hierarchy

System.Object
   System.Runtime.Serialization.SerializationBinder
      Vintasoft.Imaging.Annotation.Formatters.AnnotationSerializationBinder

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also