当前位置: 首页>>代码示例>>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;未经允许,请勿转载。