WriteJson() private method

private WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void
writer JsonWriter
value object
serializer Newtonsoft.Json.JsonSerializer
return void
コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="owner"></param>
        /// <returns></returns>
        public string ToScript(Control owner)
        {
            if (this.RenderColumnsOnly)
            {
                var sb     = new StringBuilder();
                var sw     = new StringWriter(sb);
                var writer = new JsonTextWriter(sw);

                ItemCollectionJsonConverter converter = new ItemCollectionJsonConverter();
                converter.Name         = "columns";
                converter.PropertyName = "Items";
                converter.Owner        = this;

                converter.WriteJson(writer, this.ItemsProxy, null);

                return(sw.GetStringBuilder().ToString());
            }
            else
            {
                return(new ClientConfig().Serialize(this, true));
            }
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="owner"></param>
        /// <returns></returns>
        public string ToScript(Control owner)
        {
            if (this.RenderColumnsOnly)
            {
                StringBuilder sb = new StringBuilder();
                StringWriter sw = new StringWriter(sb);
                JsonTextWriter writer = new JsonTextWriter(sw);

                ItemCollectionJsonConverter converter = new ItemCollectionJsonConverter();
                converter.Name = "columns";
                converter.PropertyName = "Items";
                converter.Owner = this;

                converter.WriteJson(writer, this.ItemsProxy, null);               
                
                return sw.GetStringBuilder().ToString();
            }
            else
            {
                return new ClientConfig().Serialize(this, true);
            }
        }