Class NewtonsoftAnybillSerializerBase
Base class with common functionality for IAnybillSerializer.
Inheritance
System.Object
NewtonsoftAnybillSerializerBase
Implements
Namespace: anybill.POS.Client.Newtonsoft
Assembly: anybill.POS.Client.Newtonsoft.dll
Syntax
public abstract class NewtonsoftAnybillSerializerBase : IAnybillSerializer
Methods
CreateJsonSerializerSettings()
Creates the anybill.POS.Client.Newtonsoft.NewtonsoftAnybillSerializerBase.JsonSerializerSettings to use whith Newtonsoft.Json.
Declaration
protected abstract JsonSerializerSettings CreateJsonSerializerSettings()
Returns
| Type | Description |
|---|---|
| Newtonsoft.Json.JsonSerializerSettings | An instance of anybill.POS.Client.Newtonsoft.NewtonsoftAnybillSerializerBase.JsonSerializerSettings. |
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. |