Skip to main content

NullableStructSerializer<TStruct>

A class in Root.Township, Alta.Console.

JSON converter for a nullable struct that writes null or hands the value to the struct's own converter. Created by AddNullableConverters.

Constructors​

MemberWhat it is
NullableStructSerializer()Creates a NullableStructSerializer with default values.

Methods​

MemberWhat it is
override TStruct? ReadJson(JsonReader reader, Type objectType, TStruct? existingValue, bool hasExistingValue, JsonSerializer serializer)Returns null for a JSON null, otherwise deserializes the struct.
override void WriteJson(JsonWriter writer, TStruct? value, JsonSerializer serializer)Writes null when empty, otherwise serializes the value.