Beispiel #1
0
        /// <summary>
        /// Writes a JSON array of JSON strings given an array of
        /// <see cref="String"/> values.
        /// </summary>

        public void WriteStringArray(params string[] values)
        {
            if (values == null)
            {
                WriteNull();
            }
            else
            {
                WriteStartArray();

                foreach (string value in values)
                {
                    if (JsonNull.LogicallyEquals(value))
                    {
                        WriteNull();
                    }
                    else
                    {
                        WriteString(value);
                    }
                }

                WriteEndArray();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Writes a JSON array of JSON strings given an enumerable source
        /// of arbitrary <see cref="Object"/> values.
        /// </summary>

        public void WriteStringArray(IEnumerable values)
        {
            if (values == null)
            {
                WriteNull();
            }
            else
            {
                WriteStartArray();

                foreach (object value in values)
                {
                    if (JsonNull.LogicallyEquals(value))
                    {
                        WriteNull();
                    }
                    else
                    {
                        WriteString(value.ToString());
                    }
                }

                WriteEndArray();
            }
        }