Skip to main content
All docs
V23.2

DiagramSerializer.RegisterConverter<T>(Func<T, String>, Func<String, T>) Method

Registers a custom serialization converter for the specified type.

Namespace: DevExpress.Diagram.Core.Serialization

Assembly: DevExpress.Diagram.v23.2.Core.dll

NuGet Package: DevExpress.Diagram.Core

Declaration

public static void RegisterConverter<T>(
    Func<T, string> toString,
    Func<string, T> fromString
)

Parameters

Name Type Description
toString Func<T, String>

A function that converts an object of the specified type to a string value.

fromString Func<String, T>

A function that converts a string value to an object of the specified type.

Type Parameters

Name Description
T

The type for which to register the serialization converter.

Remarks

The example below demonstrates how to register a converter for a MyCustomClass type.

 DiagramSerializer.RegisterConverter<MyCustomClass>(x => x.Name, x => new MyCustomClass() { Name = x });
See Also