mirror of
https://github.com/tribufu/tribufu-dotnet
synced 2025-06-16 18:34:19 +00:00
Create C# projects
This commit is contained in:
21
src/Tribufu.Serialization.Newtonsoft/LongStringConverter.cs
Normal file
21
src/Tribufu.Serialization.Newtonsoft/LongStringConverter.cs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Tribufu.Serialization.Newtonsoft
|
||||
{
|
||||
public class LongStringConverter : JsonConverter<ulong>
|
||||
{
|
||||
public override ulong ReadJson(JsonReader reader, Type objectType, ulong existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return ulong.Parse(reader.ToString());
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, ulong value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user