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