System.Web.Script.Serialization.JavaScriptSerializer或System.Runtime.Serialization.Json.DataContractJ

由网友(哪有骚年不犯二)分享简介:什么是两者之间的区别是什么?为什么要使用一个比其他?What's the difference between the two? Why would you use one over the other?推荐答案在这里找到:的 http://aaron-powell.spaces.live.com/blog/cn...

什么是两者之间的区别是什么?为什么要使用一个比其他?

What's the difference between the two? Why would you use one over the other?

推荐答案

在这里找到:的 http://aaron-powell.spaces.live.com/blog/cns!91A824220E2BF369!150.entry

DataContractJsonSerializer 该DataContractJsonSerializer的主要目的是要与WCF使用,因为一个序列是WCF的一大焦点。此外,它也更好地处理复杂的类具有可序列化只是某些属性。 这个类是更强类型,有大约类型(S)更多的知识它的操控性和更好的错误处理不好形成JSON。

DataContractJsonSerializer The primary purpose of the DataContractJsonSerializer is to be used with WCF, since one serialization is a big focus of WCF. Also, it is also better equipped to handle complex classes which have only certain properties available for serialization. This class is more strongly typed, has more knowledge about the type(s) it's handling and better error handling for badly-formed JSON.

JavaScriptSerializer 此类在另一方面是更好的装备进行快速的序列化,这是一个更加牛仔的方法。有较少的错误检查和过什么样的属性这是序列化的控制较少。

JavaScriptSerializer This class on the other hand is much better equipped for quick serialization, it's a more cowboy approach. There's less error checking and less control over what properties which are serialized.

更新

由于上面的链接是死的,这里是另一个链接: http://kb.cnblogs.com / A / 1454030 。

As the above link is dead, here is another link: http://kb.cnblogs.com/a/1454030.

阅读全文

相关推荐

最新文章