本文整理汇总了C#中JsonConverter.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# JsonConverter.GetType方法的具体用法?C# JsonConverter.GetType怎么用?C# JsonConverter.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonConverter
的用法示例。
在下文中一共展示了JsonConverter.GetType方法的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);
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);
}
}
示例2: DeserializeConvertable
// Token: 0x06000BD8 RID: 3032
// RVA: 0x00045C64 File Offset: 0x00043E64
private object DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, object existingValue)
{
if (this.TraceWriter != null && this.TraceWriter.LevelFilter >= TraceLevel.Info)
{
this.TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(reader as IJsonLineInfo, reader.Path, StringUtils.FormatWith("Started deserializing {0} with converter {1}.", CultureInfo.InvariantCulture, objectType, converter.GetType())), null);
}
object result = converter.ReadJson(reader, objectType, existingValue, this.GetInternalSerializer());
if (this.TraceWriter != null && this.TraceWriter.LevelFilter >= TraceLevel.Info)
{
this.TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(reader as IJsonLineInfo, reader.Path, StringUtils.FormatWith("Finished deserializing {0} with converter {1}.", CultureInfo.InvariantCulture, objectType, converter.GetType())), null);
}
return result;
}
示例3: DeserializeConvertable
private object DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, object existingValue)
{
if (TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Info)
TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(reader as IJsonLineInfo, reader.Path, "Started deserializing {0} with converter {1}.".FormatWith(CultureInfo.InvariantCulture, objectType, converter.GetType())), null);
object value = converter.ReadJson(reader, objectType, existingValue, GetInternalSerializer());
if (TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Info)
TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(reader as IJsonLineInfo, reader.Path, "Finished deserializing {0} with converter {1}.".FormatWith(CultureInfo.InvariantCulture, objectType, converter.GetType())), null);
return value;
}
示例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);
}