/// <summary> /// Converts the string representation of a TripleStatement to its /// struct equivalent. A return value indicates whether the /// operation succeeded. /// </summary> /// <param name="input">A string to convert.</param> /// <param name="value"> /// When this method returns, contains the struct equivalent of the value contained /// in input, if the conversion succeeded, or default(TripleStatement) if the conversion /// failed. The conversion fails if the input parameter is null or String.Empty, or is /// not of the correct format. This parameter is passed uninitialized. /// </param> /// <returns>True if input was converted successfully; otherwise, false.</returns> public unsafe static bool TryParse(string input, out TripleStatement value) { try { value = Newtonsoft.Json.JsonConvert.DeserializeObject <TripleStatement>(input); return(true); } catch { value = default(TripleStatement); return(false); } }
private static void ToString_impl(TripleStatement value, StringBuilder str_builder, bool in_json) { { str_builder.Append('{'); bool first_field = true; { if (first_field) { first_field = false; } else { str_builder.Append(','); } str_builder.Append("\"RefId\":"); ToString_impl(value.RefId, str_builder, in_json: true); } { if (value.Subject != null) { if (first_field) { first_field = false; } else { str_builder.Append(','); } str_builder.Append("\"Subject\":"); ToString_impl(value.Subject, str_builder, in_json: true); } } { if (value.Predicate != null) { if (first_field) { first_field = false; } else { str_builder.Append(','); } str_builder.Append("\"Predicate\":"); ToString_impl(value.Predicate, str_builder, in_json: true); } } { if (value.Object != null) { if (first_field) { first_field = false; } else { str_builder.Append(','); } str_builder.Append("\"Object\":"); ToString_impl(value.Object, str_builder, in_json: true); } } str_builder.Append('}'); } }
/// <summary> /// Serializes a TripleStatement object to Json string. /// </summary> /// <param name="value">The target object to be serialized.</param> /// <returns>The serialized Json string.</returns> public static string ToString(TripleStatement value) { s_ensure_string_builder(); ToString_impl(value, s_stringBuilder, in_json: false); return(s_stringBuilder.ToString()); }