如何在JsonWriter
课程调试期间看到JsonConverter
中累积的所有文字?
class LookupConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var lu = value as Lookup<string, MyClass>;
foreach (var i in lu.SelectMany(nodes => nodes))
{
// I want to setup a breakpoint here and examine the
// "text" accumulated in `writer`...
}
}
/*
...
*/
}
答案 0 :(得分:0)
好的,明白了:
((Newtonsoft.Json.JsonTextWriter)(writer))._writer.ToString()