Пример #1
0
        /// <summary>
        /// Write the required property (name/value).
        /// </summary>
        /// <param name="writer">The JSON writer.</param>
        /// <param name="name">The property name.</param>
        /// <param name="value">The property value.</param>
        public static void WriteRequiredProperty(this IJsonWriter writer, string name, decimal value)
        {
            //      EdmUtil.CheckArgumentNull(writer, "writer");
            EdmUtil.CheckNullOrWhiteSpace(name, "name");

            writer.WritePropertyName(name);
            writer.WriteValue(value);
        }
Пример #2
0
        /// <summary>
        /// Write the required property (name/value).
        /// </summary>
        /// <typeparam name="T">The value type.</typeparam>
        /// <param name="writer">The JSON writer.</param>
        /// <param name="name">The property name.</param>
        /// <param name="value">The property value.</param>
        /// <param name="toString">The value to string Func.</param>
        public static void WriteRequiredProperty <T>(this IJsonWriter writer, string name, T value, Func <T, string> toString)
        {
            EdmUtil.CheckArgumentNull(writer, "writer");
            EdmUtil.CheckNullOrWhiteSpace(name, "name");

            writer.WritePropertyName(name);
            writer.WriteValue(toString(value));
        }
Пример #3
0
        /// <summary>
        /// Write the optional property (name/value).
        /// </summary>
        /// <param name="writer">The JSON writer.</param>
        /// <param name="name">The property name.</param>
        /// <param name="value">The property value.</param>
        public static void WriteOptionalProperty(this IJsonWriter writer, string name, string value)
        {
            EdmUtil.CheckArgumentNull(writer, "writer");
            EdmUtil.CheckNullOrWhiteSpace(name, "name");

            if (value != null)
            {
                writer.WritePropertyName(name);
                writer.WriteValue(value);
            }
        }