如何在JsonConverter类调试期间查看JsonWriter中累积的所有文本?

时间:2013-10-20 15:15:11

标签: c# json.net

如何在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`...
        }
    }
    /*
    ...
    */
}

1 个答案:

答案 0 :(得分:0)

好的,明白了:

((Newtonsoft.Json.JsonTextWriter)(writer))._writer.ToString()