Class DefaultAnybillSerializerBase
Base class with common functionality for IAnybillSerializer.
Inheritance
System.Object
DefaultAnybillSerializerBase
Implements
Namespace: anybill.POS.Client.Serialization
Assembly: anybill.POS.Client.dll
Syntax
public abstract class DefaultAnybillSerializerBase : IAnybillSerializer
Methods
CreateJsonSerializerOptions()
Creates the anybill.POS.Client.Serialization.DefaultAnybillSerializerBase.JsonSerializerOptions to use whith System.Text.Json.
Declaration
protected abstract JsonSerializerOptions CreateJsonSerializerOptions()
Returns
Type | Description |
---|---|
System.Text.Json.JsonSerializerOptions | An instance of anybill.POS.Client.Serialization.DefaultAnybillSerializerBase.JsonSerializerOptions. |
Deserialize<T>(String)
Reads the JSON value of the value
into an object.
Declaration
public T Deserialize<T>(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The JSON data to parse. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The target type of the JSON value. |
DeserializeAsync<T>(Stream, CancellationToken)
Reads the JSON value of the stream
into an object.
Declaration
public async Task<T> DeserializeAsync<T>(Stream stream, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The JSON data to parse. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | A |
Type Parameters
Name | Description |
---|---|
T | The target type of the JSON value. |
Serialize<T>(T)
Serializes the object into a JSON value.
Declaration
public string Serialize<T>(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to convert. |
Returns
Type | Description |
---|---|
System.String | A JSON string represantation of the value. |
Type Parameters
Name | Description |
---|---|
T | The type of the value to serialize. |