/// <inheritdoc/> public override int GetHashCode() { switch (Type) { case LdValueType.Null: return(0); case LdValueType.Bool: return(AsBool.GetHashCode()); case LdValueType.Number: return(AsFloat.GetHashCode()); case LdValueType.String: return(AsString.GetHashCode()); case LdValueType.Array: { var h = new HashCodeBuilder(); foreach (var item in AsList(Convert.Json)) { h = h.With(item); } return(h.Value); } case LdValueType.Object: { var h = new HashCodeBuilder(); var d = AsDictionary(Convert.Json); var keys = d.Keys.ToArray(); Array.Sort(keys); // inefficient, but ensures determinacy foreach (var key in keys) { h = h.With(key).With(d[key]); } return(h.Value); } default: return(0); } }
public override string ToString() { string val = m_Data != null ? m_Data : Value; switch (type) { case BasicType.BOOL: return(AsBool ? "true" : "false"); case BasicType.INT: return(AsInt.ToString()); case BasicType.DOUBLE: return(AsDouble.ToString()); case BasicType.FLOAT: return(AsFloat.ToString()); case BasicType.STRING: default: return("\"" + Escape(val) + "\""); } }
/// <inheritdoc /> public int CompareTo(float AFloat) { return(AsFloat.CompareTo(AFloat)); }