使用JavaScriptSerializer在C#中进行结构序列化 [英] Struct Serialization in C# with JavaScriptSerializer

查看:98
本文介绍了使用JavaScriptSerializer在C#中进行结构序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个要求,我希望在JavaScriptSerializer的帮助下序列化各种属性,如System.Windows.FontWeight,FontStretch和其他此类结构。



但是在将具有struct数据类型属性的对象序列化为json时,它给出了上述属性的空json值。



上述问题的任何通用解决方案??



谢谢



Dhiraj V

Hi,

I have a requirement in which i want to serialize various properties like System.Windows.FontWeight,FontStretch and other such structs with the help of JavaScriptSerializer.

But it is giving empty json value of above properties on serializing the object having struct data type properties to json.

Any generic solution to the above problem??

Thanks

Dhiraj V

推荐答案

JsonValue = json.Serialize(List_name/Class_name.Value_tobe_serialised));



试试这个


Try this


这篇关于使用JavaScriptSerializer在C#中进行结构序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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