/// <summary>Gets the int from a JsonValue.</summary> public static int Qi(this JsonValue json) { if (json != null && json.JsonType == JsonType.Number) { return(Convert.ToInt32(json.ToValue())); } else { throw failQ(json, "Qi"); } }
/// <summary>Gets the long from a JsonValue.</summary> public static long Ql(this JsonValue json) { if (json != null && json.JsonType == JsonType.Number) { return(Convert.ToInt64(json.ToValue())); } else { throw failQ(json, "Ql"); } }
/// <summary>Gets the bool from a JsonValue.</summary> public static bool Qb(this JsonValue json) { if (json != null && json.JsonType == JsonType.Boolean) { return((bool)json.ToValue()); } else { throw failQ(json, "Qb"); } }
/// <summary>Gets the double from a JsonValue.</summary> public static double Qd(this JsonValue json) { if (json != null && json.JsonType == JsonType.Number) { return(Convert.ToDouble(json.ToValue())); } else { throw failQ(json, "Qd"); } }
/// <summary>Gets the double from a JsonValue.</summary> public static double Qd(this JsonValue json) { if (json != null && json.JsonType == JsonType.Number) { return(Convert.ToDouble(json.ToValue())); } else { throw new Exception("Missing JsonType.Number!"); } }
/// <summary>Gets the bool from a JsonValue.</summary> public static bool Qb(this JsonValue json) { if (json != null && json.JsonType == JsonType.Boolean) { return((bool)json.ToValue()); } else { throw new Exception("Missing JsonType.Boolean!"); } }
/// <summary>For JsonValues with type number, this method will return its /// value as long, otherwise it will throw.</summary> public static ulong Qul(this JsonValue json) { unchecked { if (json != null && json.JsonType == JsonType.Number) { return((ulong)Convert.ToUInt64(json.ToValue())); } else { throw failQ(json, "Ql"); } } }