Class JsonArraySerializer
A special-purpose streaming serializer for arrays to JSON. Only supports a limited number of types (boolean, DateTimeOffset, decimal, Enum, int, long, string, and trait dictionaries).
public sealed class JsonArraySerializer : JsonSerializerBase, IDisposable
- Inheritance
-
JsonArraySerializer
- Implements
- Inherited Members
- Extension Methods
Remarks
These types are made public for third parties only for the purpose of serializing and deserializing messages that are sent across the process boundary (that is, types which implement IMessageSinkMessage). Any other usage is not supported.
Constructors
JsonArraySerializer(StringBuilder, Action?)
A special-purpose streaming serializer for arrays to JSON. Only supports a limited number of types (boolean, DateTimeOffset, decimal, Enum, int, long, string, and trait dictionaries).
public JsonArraySerializer(StringBuilder buffer, Action? disposeNotifier = null)
Parameters
bufferStringBuilderThe buffer to write JSON to
disposeNotifierActionAn optional callback to be notified when disposed
Remarks
These types are made public for third parties only for the purpose of serializing and deserializing messages that are sent across the process boundary (that is, types which implement IMessageSinkMessage). Any other usage is not supported.
Methods
Serialize(IReadOnlyDictionary<string, IReadOnlyCollection<string>>)
Serialize a trait dictionary value into the array.
public void Serialize(IReadOnlyDictionary<string, IReadOnlyCollection<string>> dictionary)
Parameters
dictionaryIReadOnlyDictionary<string, IReadOnlyCollection<string>>
Serialize(Enum?)
Serialize an Enum value into the array.
public void Serialize(Enum? value)
Parameters
valueEnum
Serialize(bool?)
Serialize a bool value into the array.
public void Serialize(bool? value)
Parameters
valuebool?
Serialize(DateTimeOffset?)
Serialize a DateTimeOffset value into the array.
public void Serialize(DateTimeOffset? value)
Parameters
valueDateTimeOffset?
Serialize(decimal?)
Serialize a decimal value into the array.
public void Serialize(decimal? value)
Parameters
valuedecimal?
Serialize(int?)
Serialize an int value into the array.
public void Serialize(int? value)
Parameters
valueint?
Serialize(long?)
Serialize a long value into the array.
public void Serialize(long? value)
Parameters
valuelong?
Serialize(string?)
Serialize a string value into the array.
public void Serialize(string? value)
Parameters
valuestring
SerializeArray()
Start serializing an array into the array.
public JsonArraySerializer SerializeArray()
Returns
Remarks
IMPORTANT: This serializer must be used completely and disposed before any other value is serialized into the array, or the serialization will be corrupted.
SerializeObject()
Start serializing an object into the array.
public JsonObjectSerializer SerializeObject()
Returns
Remarks
IMPORTANT: This serializer must be used completely and disposed before any other value is serialized into the array, or the serialization will be corrupted.