我读过有关Generations和Large object heap的内容.但我仍然不明白拥有大型对象堆的意义(或好处)是什么?
如果CLR只是依赖于第2代(考虑到Gen0和Gen1的阈值很小来处理大型对象)来存储大型对象,那么可能出现什么问题(在性能或内存方面)?
我打电话给google的词典api,如下所示:
var json = new WebClient().DownloadString(string.Format(@"http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&q={0}&sl=en&tl=en", "bar"));
Run Code Online (Sandbox Code Playgroud)
但是我得到一个响应,该代码无法正确解析:
json = json.Replace("dict_api.callbacks.id100(", "").Replace(",200,null)", "");
JObject o = JObject.Parse(json);
Run Code Online (Sandbox Code Playgroud)
解析在遇到这个问题时死了:
"entries":[{"type":"example","terms":[{"type":"text","text":"\x3cem\x3ebars\x3c/em\x3e of sunlight shafting through the broken windows","language":"en"}]}]}
Run Code Online (Sandbox Code Playgroud)
该
\ x3cem\x3ebars\X
东西杀了解析
有没有办法用JSON.NET处理这个JSONP响应?
将答案通过阿奎那的另一个"解析JSONP"问题表明不错的正则表达式x = Regex.Replace(x, @"^.+?\(|\)$", "");来处理与JSONP部分(可能需要调整这种情况正则表达式),所以主体这里是如何应对的十六进制编码的字符.