forked from ln-dotnet/ln.json
36 lines
820 B
C#
36 lines
820 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Reflection;
|
|
namespace ln.json
|
|
{
|
|
public class JSONNumber : JSONValue
|
|
{
|
|
readonly decimal decValue;
|
|
|
|
public JSONNumber(int i)
|
|
: this((long)i) { }
|
|
|
|
public JSONNumber(long integer)
|
|
: base(JSONValueType.NUMBER)
|
|
{
|
|
decValue = new decimal(integer);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|