Class LongConverter2
- Namespace
- Geotab.Serialization
- Assembly
- Geotab.Checkmate.ObjectModel.dll
A class that contains the logic to convert an object to JSON.
public class LongConverter2 : BaseJsonConverter2<long>
- Inheritance
-
LongConverter2
- Inherited Members
Constructors
LongConverter2(bool)
Initializes a new instance of the LongConverter2 class.
public LongConverter2(bool representJsonLongAsHexString = true)
Parameters
representJsonLongAsHexString
boolThe representJsonLongAsHexString.
Methods
LongToString(long)
Converts a long to a string hex representation.
public static string LongToString(long version)
Parameters
Returns
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Read and convert the JSON to T.
public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
reader
Utf8JsonReaderThe Utf8JsonReader to read from.
typeToConvert
TypeThe Type being converted.
options
JsonSerializerOptionsThe JsonSerializerOptions being used.
Returns
- long
The value that was converted.
Remarks
A converter may throw any Exception, but should throw
StringToLong(string?)
public static long? StringToLong(string? stringVersion)
Parameters
Returns
TryHexToLong(string?, out long?)
public static bool TryHexToLong(string? input, out long? result)
Parameters
input
stringA hex string representation of a long.
result
long?When this method returns, contains the long value if the conversion succeeded, or null if the conversion failed.
Returns
Write(Utf8JsonWriter, long, JsonSerializerOptions)
Write the value as JSON.
public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options)
Parameters
writer
Utf8JsonWriterThe Utf8JsonWriter to write to.
value
longThe value to convert.
options
JsonSerializerOptionsThe JsonSerializerOptions being used.
Remarks
A converter may throw any Exception, but should throw