Interface ISerializer
Namespace: LemonEdge.Utils
Assembly: LemonEdge.Utils.dll
Syntax
public interface ISerializer
Methods
BytesToString(byte[])
Converts bytes to string content
Declaration
string BytesToString(byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | The byte array |
Returns
| Type | Description |
|---|---|
| string | String content |
Deserialize(Type, byte[]?, IEnumerable<Type>?)
Deserializes from the specified data into the specified type
Declaration
object? Deserialize(Type type, byte[]? data, IEnumerable<Type>? knownTypes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type the |
| byte[] | data | The serialized stream |
| IEnumerable<Type> | knownTypes | Additional known types involved in the original serialization |
Returns
| Type | Description |
|---|---|
| object | A new instance of |
Deserialize(Type, string?, IEnumerable<Type>?)
Deserializes from the specified string into the specified type
Declaration
object? Deserialize(Type type, string? @string, IEnumerable<Type>? knownTypes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type the |
| string | string | The serialized stream |
| IEnumerable<Type> | knownTypes | Additional known types involved in the original serialization |
Returns
| Type | Description |
|---|---|
| object | A new instance of |
Deserialize<T>(byte[]?, IEnumerable<Type>?)
Deserializes from the specified data into the specified type T
Declaration
T? Deserialize<T>(byte[]? data, IEnumerable<Type>? knownTypes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | The serialized stream |
| IEnumerable<Type> | knownTypes | Additional known types involved in the original serialization |
Returns
| Type | Description |
|---|---|
| T | A new instance of |
Type Parameters
| Name | Description |
|---|---|
| T | The type the |
Deserialize<T>(string?, IEnumerable<Type>?)
Deserializes from the specified stream into the specified type T
Declaration
T? Deserialize<T>(string? stream, IEnumerable<Type>? knownTypes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | stream | The serialized stream |
| IEnumerable<Type> | knownTypes | Additional known types involved in the original serialization |
Returns
| Type | Description |
|---|---|
| T | A new instance of |
Type Parameters
| Name | Description |
|---|---|
| T | The type the |
Serialize(object?, IEnumerable<Type>?)
Serializes the specified obj into a string stream
Declaration
string Serialize(object? obj, IEnumerable<Type>? knownTypes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to be serialized |
| IEnumerable<Type> | knownTypes | Any known types referenced by the |
Returns
| Type | Description |
|---|---|
| string | A serialized string of the |
SerializeToBytes(object?, IEnumerable<Type>?)
Serializes the specified obj into a byte array stream
Declaration
byte[] SerializeToBytes(object? obj, IEnumerable<Type>? knownTypes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to be serialized |
| IEnumerable<Type> | knownTypes | Any known types referenced by the |
Returns
| Type | Description |
|---|---|
| byte[] | A serialized byte array of the |
StringToBytes(string)
Converts a string to a byte array
Declaration
byte[] StringToBytes(string @string)
Parameters
| Type | Name | Description |
|---|---|---|
| string | string | The string |
Returns
| Type | Description |
|---|---|
| byte[] | A byte array |