/// <summary>
 /// Converts the string representation of a StoreTripleResponse 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(StoreTripleResponse) 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 StoreTripleResponse value)
 {
     try
     {
         value = Newtonsoft.Json.JsonConvert.DeserializeObject <StoreTripleResponse>(input);
         return(true);
     }
     catch { value = default(StoreTripleResponse); return(false); }
 }
コード例 #2
0
        private static void ToString_impl(StoreTripleResponse 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('}');
            }
        }
コード例 #3
0
 /// <summary>
 /// Serializes a StoreTripleResponse 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(StoreTripleResponse value)
 {
     s_ensure_string_builder();
     ToString_impl(value, s_stringBuilder, in_json: false);
     return(s_stringBuilder.ToString());
 }