Class JsonValue
Maps values other than the JObject and JArray in JSON standards to primitive value types.
Inherited Members
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
[Serializable]
public sealed class JsonValue : JsonValueBase
Methods
Equals(Object)
Checks if object is equal to JSON value object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to be compared. |
Returns
Type | Description |
---|---|
System.Boolean | True, if obj is equal to this object. |
Overrides
GetHashCode()
Gets HashCode of the value.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Hashcode of value. |
Overrides
ToBoolean()
Attempts to convert JSON value to boolean.
Declaration
public bool ToBoolean()
Returns
Type | Description |
---|---|
System.Boolean | Converted boolean value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
ToByte()
Attempts to convert JSON value to byte.
Declaration
public byte ToByte()
Returns
Type | Description |
---|---|
System.Byte | Converted byte value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToDateTime()
Attempts to convert JSON value to DateTime with standard format and culture.
Declaration
public DateTime ToDateTime()
Returns
Type | Description |
---|---|
System.DateTime | Converted DateTime value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid or when a composite format string is not well formed. |
System.ArgumentNullException | The exception that is thrown when a null reference (nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. |
ToDateTime(String, IFormatProvider)
Attempts to convert JSON value to DateTime with provided format.
Declaration
public DateTime ToDateTime(string format, IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | DateTime format for conversion. |
System.IFormatProvider | provider | Format control for DateTime. |
Returns
Type | Description |
---|---|
System.DateTime | Converted DateTime value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.ArgumentNullException | The exception that is thrown when a null reference (nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. |
ToDecimal()
Attempts to convert JSON value to decimal.
Declaration
public decimal ToDecimal()
Returns
Type | Description |
---|---|
System.Decimal | Converted decimal value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToDouble()
Attempts to convert JSON value to double.
Declaration
public double ToDouble()
Returns
Type | Description |
---|---|
System.Double | Converted double value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToFloat()
Attempts to convert JSON value to float.
Declaration
public float ToFloat()
Returns
Type | Description |
---|---|
System.Single | Converted float value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToInt16()
Attempts to convert JSON value to short.
Declaration
public short ToInt16()
Returns
Type | Description |
---|---|
System.Int16 | Converted short value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToInt32()
Attempts to convert JSON value to int 32.
Declaration
public int ToInt32()
Returns
Type | Description |
---|---|
System.Int32 | Converted int value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToInt64()
Attempts to convert JSON value to int 64.
Declaration
public long ToInt64()
Returns
Type | Description |
---|---|
System.Int64 | Converted long value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToSByte()
Attempts to convert JSON value to sbyte.
Declaration
public sbyte ToSByte()
Returns
Type | Description |
---|---|
System.SByte | Converted sbyte value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToString()
Represents in string format.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of the object. |
Overrides
ToStringValue()
Attempts to convert JSON value to string.
Declaration
public string ToStringValue()
Returns
Type | Description |
---|---|
System.String | Converted string value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
ToUInt16()
Attempts to convert JSON value to unsigned int 16.
Declaration
public ushort ToUInt16()
Returns
Type | Description |
---|---|
System.UInt16 | Converted ushort value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToUInt32()
Attempts to convert JSON value to unsigned int 32.
Declaration
public uint ToUInt32()
Returns
Type | Description |
---|---|
System.UInt32 | Converted ushort value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
ToUInt64()
Attempts to convert JSON value to unsigned int 64.
Declaration
public ulong ToUInt64()
Returns
Type | Description |
---|---|
System.UInt64 | Converted ulong value. |
Exceptions
Type | Condition |
---|---|
System.FormatException | The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. |
System.InvalidCastException | The exception that is thrown for invalid casting or explicit conversion. |
System.OverflowException | The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. |
Operators
Explicit(String to JsonValue)
Explicit operator overload to convert string to JSONValue.
Declaration
public static explicit operator JsonValue(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | string value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(Boolean to JsonValue)
Implicit operator overload to conveert boolean to JSONValue.
Declaration
public static implicit operator JsonValue(bool value)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | value | Boolean value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(Byte to JsonValue)
Implicit operator overload to convert byte to JSONValue.
Declaration
public static implicit operator JsonValue(byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | Byte value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(DateTime to JsonValue)
Implicit operator overload to conert DateTime to JSONValue with standard format and culture.
Declaration
public static implicit operator JsonValue(DateTime value)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | DateTime value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(Decimal to JsonValue)
Implicit operator overload to convert decimal to JSONValue.
Declaration
public static implicit operator JsonValue(decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | Decimal value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(Double to JsonValue)
Implicit operator overload to convert double to JSONValue.
Declaration
public static implicit operator JsonValue(double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | Double value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(Int16 to JsonValue)
Implicit operator overload to convert short to JSONValue.
Declaration
public static implicit operator JsonValue(short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | Short value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(Int32 to JsonValue)
Implicit operator overload to convert int to JSONValue.
Declaration
public static implicit operator JsonValue(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | int value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(Int64 to JsonValue)
Implicit operator overload to convert long to JSONValue.
Declaration
public static implicit operator JsonValue(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | long value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(BigInteger to JsonValue)
Implicit operator overload to convert BigInteger to JSONValue.
Declaration
public static implicit operator JsonValue(BigInteger value)
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.BigInteger | value | BigInteger value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(SByte to JsonValue)
Implicit operator overload to convert sbyte to JSONValue.
Declaration
public static implicit operator JsonValue(sbyte value)
Parameters
Type | Name | Description |
---|---|---|
System.SByte | value | Sbyte value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(Single to JsonValue)
Implicit operator overload to convert float to JSONValue.
Declaration
public static implicit operator JsonValue(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | float value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(UInt16 to JsonValue)
Implicit operator overload to convert ushort to JSONValue.
Declaration
public static implicit operator JsonValue(ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | ushort value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(UInt32 to JsonValue)
Implicit operator overload to convert uint to JSONValue.
Declaration
public static implicit operator JsonValue(uint value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | value | uint value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |
Implicit(UInt64 to JsonValue)
Implicit operator overload to convert ulong to JSONValue
Declaration
public static implicit operator JsonValue(ulong value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | value | ulong value. |
Returns
Type | Description |
---|---|
JsonValue | Json value. |