C#序列化对象的集合 [英] C# Serializing a Collection of Objects

查看:512
本文介绍了C#序列化对象的集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作有一个继承自定义对象列表的类ASP.NET应用程序。

I am working on a ASP.NET application that has a class that inherits a List of a Custom Object.

public class UserRoleList : List<UserRoleBO> {
    public UserRoleList() { }
}



我如何使这个类在C#序列化?

How do I make this class serializable in C#?

推荐答案

我相信你真的只需要确保UserRoleBO是可序列化的名单将自己照顾自己。这是假设你要序列值都在UserRoleBO和UserList的公共属性。欲了解更多信息请参见 http://stackoverflow.com/questions/810974/什么 - 是最点的最ISerializable的接口

I believe you really just need to ensure that UserRoleBO is serializable and the list will take care of itself. This assumes the values you want to serialize are public properties on the UserRoleBO and UserList. For more info see http://stackoverflow.com/questions/810974/what-is-the-point-of-the-iserializable-interface

这篇关于C#序列化对象的集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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