本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}