2013-10-20 39 views
0

如何在JsonConverter類調​​試期間在JsonWriter中累積文本如何在JsonConverter類調試期間看到JsonWriter中積累的所有文本?

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

好的,知道了:

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