Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonWriter"/> class.
        /// </summary>
        /// <param name="textWriter">Text writer.</param>
        /// <param name="settings">Custom settings.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <list type="bullet">
        /// <item>If <paramref name="textWriter"/> is <c>null</c>.</item>
        /// <item>If <paramref name="settings"/> is <c>null</c>.</item>
        /// </list>
        /// </exception>
        private JsonWriter(TextWriter textWriter, JsonWriterSettings settings)
        {
            if (textWriter == null)
            {
                throw new ArgumentNullException("textWriter");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            this.writer   = textWriter;
            this.Settings = settings;

            settings.MarkReadOnly();

            this.writeContextStack.Push(WriteContext.Root);
        }
 static JsonWriterSettings()
 {
     DefaultSettings = new JsonWriterSettings();
     DefaultSettings.MarkReadOnly();
 }