<PackageReference Include="System.ClientModel" Version="1.6.1" />

System.ClientModel.Primitives.ModelReaderWriter

public static class ModelReaderWriter
Provides functionality to read and write IPersistableModel<T> and IJsonModel<T>.
public static T Read<T>(BinaryData data, ModelReaderWriterOptions options = null) where T : IPersistableModel<T>

Converts the BinaryData into a T.

public static T Read<T>(BinaryData data, ModelReaderWriterOptions options, ModelReaderWriterContext context)

Converts the BinaryData into a T.

public static object Read(BinaryData data, Type returnType, ModelReaderWriterOptions options = null)

Converts the BinaryData into a returnType.

public static object Read(BinaryData data, Type returnType, ModelReaderWriterOptions options, ModelReaderWriterContext context)

Converts the BinaryData into a returnType.

public static BinaryData Write<T>(T model, ModelReaderWriterOptions options = null) where T : IPersistableModel<T>

Converts the value of a model into a BinaryData.

public static BinaryData Write(object model, ModelReaderWriterOptions options = null)

Converts the value of a model into a BinaryData.

public static BinaryData Write<T>(T model, ModelReaderWriterOptions options, ModelReaderWriterContext context)

Converts the value of a model into a BinaryData.

public static BinaryData Write(object model, ModelReaderWriterOptions options, ModelReaderWriterContext context)

Converts the value of a model into a BinaryData.