Class DelegatingConverterBase
Converter which does nothing but delegate to another one for all operations.
Since 2.0.x
Availability netstandard2.0
Inherited Members
Namespace: NodaTime.Serialization.JsonNet
Assembly: NodaTime.Serialization.JsonNet.dll
Syntax
public abstract class DelegatingConverterBase : JsonConverter
Remarks
Nothing in this class is specific to Noda Time. Its purpose is to make it easy
to reuse other converter instances with JsonConverterAttribute,
which can only identify a converter by type.
Examples
If you had some LocalDate properties which needed one converter, but others that needed another, you might want to have different types implementing those converters. Each type would just derive from this, passing the right converter into the base constructor.
public sealed class ShortDateConverter : DelegatingConverterBase
{
public ShortDateConverter() : base(NodaConverters.LocalDateConverter) {}
}
Constructors
DelegatingConverterBase(JsonConverter)
Constructs a converter delegating to
original
.
Since 2.0.x
Availability netstandard2.0
Declaration
protected DelegatingConverterBase(JsonConverter original)
Parameters
Type | Name | Description |
---|---|---|
JsonConverter | original | The converter to delegate to. Must not be null. |
Remarks
Nothing in this class is specific to Noda Time. Its purpose is to make it easy
to reuse other converter instances with JsonConverterAttribute,
which can only identify a converter by type.
Properties
CanRead
Since 2.0.x
Availability netstandard2.0
Declaration
public override bool CanRead { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Newtonsoft.Json.JsonConverter.CanRead
Remarks
Nothing in this class is specific to Noda Time. Its purpose is to make it easy
to reuse other converter instances with JsonConverterAttribute,
which can only identify a converter by type.
CanWrite
Since 2.0.x
Availability netstandard2.0
Declaration
public override bool CanWrite { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Newtonsoft.Json.JsonConverter.CanWrite
Remarks
Nothing in this class is specific to Noda Time. Its purpose is to make it easy
to reuse other converter instances with JsonConverterAttribute,
which can only identify a converter by type.
Methods
CanConvert(Type)
Since 2.0.x
Availability netstandard2.0
Declaration
public override bool CanConvert(Type objectType)
Parameters
Type | Name | Description |
---|---|---|
Type | objectType |
Returns
Type | Description |
---|---|
bool |
Overrides
Newtonsoft.Json.JsonConverter.CanConvert(System.Type)
Remarks
Nothing in this class is specific to Noda Time. Its purpose is to make it easy
to reuse other converter instances with JsonConverterAttribute,
which can only identify a converter by type.
ReadJson(JsonReader, Type, object, JsonSerializer)
Since 2.0.x
Availability netstandard2.0
Declaration
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
JsonReader | reader | |
Type | objectType | |
object | existingValue | |
JsonSerializer | serializer |
Returns
Type | Description |
---|---|
object |
Overrides
Newtonsoft.Json.JsonConverter.ReadJson(Newtonsoft.Json.JsonReader, System.Type, object, Newtonsoft.Json.JsonSerializer)
Remarks
Nothing in this class is specific to Noda Time. Its purpose is to make it easy
to reuse other converter instances with JsonConverterAttribute,
which can only identify a converter by type.
WriteJson(JsonWriter, object, JsonSerializer)
Since 2.0.x
Availability netstandard2.0
Declaration
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
JsonWriter | writer | |
object | value | |
JsonSerializer | serializer |
Overrides
Newtonsoft.Json.JsonConverter.WriteJson(Newtonsoft.Json.JsonWriter, object, Newtonsoft.Json.JsonSerializer)
Remarks
Nothing in this class is specific to Noda Time. Its purpose is to make it easy
to reuse other converter instances with JsonConverterAttribute,
which can only identify a converter by type.