当前位置: 首页>>代码示例>>C#>>正文


C# JsonConverter.WriteJson方法代码示例

本文整理汇总了C#中JsonConverter.WriteJson方法的典型用法代码示例。如果您正苦于以下问题:C# JsonConverter.WriteJson方法的具体用法?C# JsonConverter.WriteJson怎么用?C# JsonConverter.WriteJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsonConverter的用法示例。


在下文中一共展示了JsonConverter.WriteJson方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SerializeConvertable

    private void SerializeConvertable(JsonWriter writer, JsonConverter converter, object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty)
    {
      if (ShouldWriteReference(value, null, contract, collectionContract, containerProperty))
      {
        WriteReference(writer, value);
      }
      else
      {
        if (!CheckForCircularReference(writer, value, null, contract, collectionContract, containerProperty))
          return;

        _serializeStack.Add(value);

        converter.WriteJson(writer, value, GetInternalSerializer());

        _serializeStack.RemoveAt(_serializeStack.Count - 1);
      }
    }
开发者ID:draptik,项目名称:RepoSync,代码行数:18,代码来源:JsonSerializerInternalWriter.cs

示例2: SerializeConvertable

    private void SerializeConvertable(JsonWriter writer, JsonConverter converter, object value)
    {
      if (ShouldWriteReference(value, null))
      {
        WriteReference(writer, value);
      }
      else
      {
        if (!CheckForCircularReference(value, null))
          return;

        SerializeStack.Add(value);

        converter.WriteJson(writer, value, GetInternalSerializer());

        SerializeStack.RemoveAt(SerializeStack.Count - 1);
      }
    }
开发者ID:oduma,项目名称:Sciendo.Fitas.Droid,代码行数:18,代码来源:JsonSerializerWriter.cs

示例3: SerializeConvertable

    private void SerializeConvertable(JsonWriter writer, JsonConverter converter, object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty)
    {
      if (ShouldWriteReference(value, null, contract, collectionContract, containerProperty))
      {
        WriteReference(writer, value);
      }
      else
      {
        if (!CheckForCircularReference(writer, value, null, contract, collectionContract, containerProperty))
          return;

        _serializeStack.Add(value);

        if (TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Info)
          TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(null, writer.Path, "Started serializing {0} with converter {1}.".FormatWith(CultureInfo.InvariantCulture, value.GetType(), converter.GetType())), null);

        converter.WriteJson(writer, value, GetInternalSerializer());

        if (TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Info)
          TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(null, writer.Path, "Finished serializing {0} with converter {1}.".FormatWith(CultureInfo.InvariantCulture, value.GetType(), converter.GetType())), null);

        _serializeStack.RemoveAt(_serializeStack.Count - 1);
      }
    }
开发者ID:EnergonV,项目名称:BestCS,代码行数:24,代码来源:JsonSerializerInternalWriter.cs

示例4: SerializeConvertable

 // Token: 0x06000C02 RID: 3074
 // RVA: 0x00047298 File Offset: 0x00045498
 private void SerializeConvertable(JsonWriter writer, JsonConverter converter, object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty)
 {
     if (this.ShouldWriteReference(value, null, contract, collectionContract, containerProperty))
     {
         this.WriteReference(writer, value);
         return;
     }
     if (!this.CheckForCircularReference(writer, value, null, contract, collectionContract, containerProperty))
     {
         return;
     }
     this._serializeStack.Add(value);
     if (this.TraceWriter != null && this.TraceWriter.LevelFilter >= TraceLevel.Info)
     {
         this.TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(null, writer.Path, StringUtils.FormatWith("Started serializing {0} with converter {1}.", CultureInfo.InvariantCulture, value.GetType(), converter.GetType())), null);
     }
     converter.WriteJson(writer, value, this.GetInternalSerializer());
     if (this.TraceWriter != null && this.TraceWriter.LevelFilter >= TraceLevel.Info)
     {
         this.TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(null, writer.Path, StringUtils.FormatWith("Finished serializing {0} with converter {1}.", CultureInfo.InvariantCulture, value.GetType(), converter.GetType())), null);
     }
     this._serializeStack.RemoveAt(this._serializeStack.Count - 1);
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:25,代码来源:JsonSerializerInternalWriter.cs


注:本文中的JsonConverter.WriteJson方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。