2017-11-03 13:13:09 +01:00
|
|
|
using System;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Reflection;
|
2019-08-07 23:02:00 +02:00
|
|
|
namespace ln.json
|
2017-10-26 16:41:14 +02:00
|
|
|
{
|
2019-08-07 23:02:00 +02:00
|
|
|
public class JSONNumber : JSONValue
|
|
|
|
{
|
2019-08-08 00:34:16 +02:00
|
|
|
public Decimal Decimal => decValue;
|
2019-08-07 23:02:00 +02:00
|
|
|
readonly decimal decValue;
|
|
|
|
|
|
|
|
public JSONNumber(int i)
|
|
|
|
: this((long)i) { }
|
|
|
|
|
|
|
|
public JSONNumber(long integer)
|
|
|
|
: base(JSONValueType.NUMBER)
|
|
|
|
{
|
|
|
|
decValue = new decimal(integer);
|
|
|
|
}
|
|
|
|
|
2019-08-08 00:34:16 +02:00
|
|
|
public JSONNumber(uint i)
|
|
|
|
: this((ulong)i) { }
|
|
|
|
|
|
|
|
public JSONNumber(ulong integer)
|
|
|
|
: base(JSONValueType.NUMBER)
|
|
|
|
{
|
|
|
|
decValue = new decimal(integer);
|
|
|
|
}
|
|
|
|
|
2019-08-07 23:02:00 +02:00
|
|
|
public JSONNumber(double doubleValue)
|
|
|
|
: base(JSONValueType.NUMBER)
|
|
|
|
{
|
|
|
|
decValue = new Decimal(doubleValue);
|
|
|
|
}
|
|
|
|
public JSONNumber(decimal decValue)
|
|
|
|
: base(JSONValueType.NUMBER)
|
|
|
|
{
|
|
|
|
this.decValue = decValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return decValue.ToString(CultureInfo.InvariantCulture);
|
|
|
|
}
|
|
|
|
}
|
2017-10-26 16:41:14 +02:00
|
|
|
}
|