Class TimeSpanJsonConverter
Implements a type converter for TimeSpan using the culture
invariant "c" format. This serializes TimeSpan instances
as:
[-][d'.']hh':'mm':'ss['.'fffffff]
Inheritance
TimeSpanJsonConverter
Assembly: Neon.Common.dll
Syntax
public class TimeSpanJsonConverter : JsonConverter<TimeSpan>, IEnhancedJsonConverter
Properties
Type
Returns the type handled by the converter.
Declaration
public Type Type { get; }
Property Value
Methods
ReadJson(JsonReader, Type, TimeSpan, bool, JsonSerializer)
Declaration
public override TimeSpan ReadJson(JsonReader reader, Type objectType, TimeSpan existingValue, bool hasExistingValue, JsonSerializer serializer)
Parameters
Type |
Name |
Description |
JsonReader |
reader |
|
Type |
objectType |
|
TimeSpan |
existingValue |
|
bool |
hasExistingValue |
|
JsonSerializer |
serializer |
|
Returns
ToSimpleString(object)
Converts an object instance to a simple (non-JSON) string.
Declaration
public string ToSimpleString(object instance)
Parameters
Type |
Name |
Description |
object |
instance |
The object instance.
|
Returns
Type |
Description |
string |
The rendered string.
|
WriteJson(JsonWriter, TimeSpan, JsonSerializer)
Declaration
public override void WriteJson(JsonWriter writer, TimeSpan value, JsonSerializer serializer)
Parameters
Type |
Name |
Description |
JsonWriter |
writer |
|
TimeSpan |
value |
|
JsonSerializer |
serializer |
|
Implements