JavaScriptSerializer类是否已弃用? [英] Is the JavaScriptSerializer class deprecated?

查看:119
本文介绍了JavaScriptSerializer类是否已弃用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MSDN文档:

应该使用Json.NET进行序列化和反序列化.为启用AJAX的应用程序提供序列化和反序列化功能.

Json.NET should be used serialization and deserialization. Provides serialization and deserialization functionality for AJAX-enabled applications.

这是某种弃用提示还是应该完全不使用此类(出于JSON序列化的目的)?

Should this be some sort of deprecation hint or should this class not be used in general at all (for the purpose of JSON serialization)?

推荐答案

已弃用

不.否则,他们会标记为已过时.

No. Otherwise, they would have marked it obsolete.

不应该一般使用此类

should this class not be used in general

如果您愿意,我看不出有任何理由不使用它.因此,请随时使用它,但请先阅读以下内容:

I can't see any reason not to use it if you want to. So feel free to use it, but read the below first:

现在它是最好用的序列化程序吗?基本上,甚至Microsoft都知道这一点,并使用与JavaScriptSerializer相比,它具有多个优势.新的Microsoft似乎正在尝试拥抱开源社区(希望不要熄灭它... ),并利用那里的大量工具.

Now is it the best serialiser to use? Basically no and even Microsoft know this and use Json.Net internally for things such as the Web.API. Hence the recommendation. It has several advantages over the JavaScriptSerializer. It seems the new Microsoft is attempting to embrace the open source community (hopefully not to extinguish it...) and utilise the wealth of tools out there.

似乎是Microsoft无法决定是否将其过时. 我的猜测是他们仍然维护它,因为它已在内部使用,并且重写了一些东西以使用Json.Net只是花了更多的功夫.

It seems Microsoft can't make up their minds about making it actually obsolete. My guess is they still maintain it because it's used internally and re-writing stuff to use Json.Net is just more work than it's worth.

使用Json.Net

Use Json.Net

这篇关于JavaScriptSerializer类是否已弃用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆