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
- representJsonLongAsHexStringbool
- The 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
- readerUtf8JsonReader
- The Utf8JsonReader to read from. 
- typeToConvertType
- The Type being converted. 
- optionsJsonSerializerOptions
- The 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
- inputstring
- A hex string representation of a long. 
- resultlong?
- 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
- writerUtf8JsonWriter
- The Utf8JsonWriter to write to. 
- valuelong
- The value to convert. 
- optionsJsonSerializerOptions
- The JsonSerializerOptions being used. 
Remarks
A converter may throw any Exception, but should throw