當前位置: 首頁>>代碼示例>>C#>>正文


C# JsonTextWriter.WriteOptionalProperty方法代碼示例

本文整理匯總了C#中Newtonsoft.Json.JsonTextWriter.WriteOptionalProperty方法的典型用法代碼示例。如果您正苦於以下問題:C# JsonTextWriter.WriteOptionalProperty方法的具體用法?C# JsonTextWriter.WriteOptionalProperty怎麽用?C# JsonTextWriter.WriteOptionalProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Newtonsoft.Json.JsonTextWriter的用法示例。


在下文中一共展示了JsonTextWriter.WriteOptionalProperty方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ToJsonSafe

        /// <summary>
        ///     Converts current not to JSON according to the avro specification.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="seenSchemas">The seen schemas.</param>
        internal override void ToJsonSafe(JsonTextWriter writer, HashSet<NamedSchema> seenSchemas)
        {
            if (seenSchemas.Contains(this))
            {
                writer.WriteValue(this.FullName);
                return;
            }

            seenSchemas.Add(this);
            writer.WriteStartObject();
            writer.WriteProperty("type", "fixed");
            writer.WriteProperty("name", this.FullName);
            writer.WriteOptionalProperty("aliases", this.Aliases);
            writer.WriteProperty("size", this.Size);
            writer.WriteEndObject();
        }
開發者ID:RossMerr,項目名稱:azure-sdk-for-net,代碼行數:21,代碼來源:FixedSchema.cs

示例2: ToJsonSafe

        /// <summary>
        ///     Converts current not to json according to the avro specification.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="seenSchemas">The seen schemas.</param>
        internal override void ToJsonSafe(JsonTextWriter writer, HashSet<NamedSchema> seenSchemas)
        {
            if (seenSchemas.Contains(this))
            {
                writer.WriteValue(this.FullName);
                return;
            }

            seenSchemas.Add(this);
            writer.WriteStartObject();
            writer.WriteProperty("type", "record");
            writer.WriteProperty("name", this.FullName);
            writer.WriteOptionalProperty("doc", this.Doc);
            writer.WriteOptionalProperty("aliases", this.Aliases);
            writer.WritePropertyName("fields");
            writer.WriteStartArray();
            this.fields.ForEach(_ => _.ToJson(writer, seenSchemas));
            writer.WriteEndArray();
            writer.WriteEndObject();
        }
開發者ID:RossMerr,項目名稱:azure-sdk-for-net,代碼行數:25,代碼來源:RecordSchema.cs

示例3: ToJsonSafe

        /// <summary>
        ///     Converts current not to JSON according to the avro specification.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="seenSchemas">The seen schemas.</param>
        internal override void ToJsonSafe(JsonTextWriter writer, HashSet<NamedSchema> seenSchemas)
        {
            if (seenSchemas.Contains(this))
            {
                writer.WriteValue(this.FullName);
                return;
            }

            seenSchemas.Add(this);
            writer.WriteStartObject();
            writer.WriteProperty("type", "enum");
            writer.WriteProperty("name", this.FullName);
            writer.WriteOptionalProperty("doc", this.Doc);
            writer.WritePropertyName("symbols");
            writer.WriteStartArray();
            this.symbols.ForEach(writer.WriteValue);
            writer.WriteEndArray();
            writer.WriteEndObject();
        }
開發者ID:RossMerr,項目名稱:azure-sdk-for-net,代碼行數:24,代碼來源:EnumSchema.cs

示例4: ToJsonSafe

 /// <summary>
 ///     Converts current not to JSON according to the avro specification.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="seenSchemas">The seen schemas.</param>
 internal override void ToJsonSafe(JsonTextWriter writer, HashSet<NamedSchema> seenSchemas)
 {
     writer.WriteStartObject();
     writer.WriteProperty("name", this.FullName);
     writer.WriteOptionalProperty("doc", this.Doc);
     writer.WriteOptionalProperty("aliases", this.Aliases);
     writer.WritePropertyName("type");
     this.TypeSchema.ToJson(writer, seenSchemas);
     writer.WriteEndObject();
 }
開發者ID:RossMerr,項目名稱:azure-sdk-for-net,代碼行數:15,代碼來源:RecordField.cs


注:本文中的Newtonsoft.Json.JsonTextWriter.WriteOptionalProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。