当前位置:编程学习 > C#/ASP.NET >>

含有对象集合作为属性的对象序列化问题

public class ConfigInfo
        {
            private string _username;
            private string _password;
            private IList<DisableRuleInfo> _list;
            

            public string UserName
            {
                get { return _username; }
                set { _username = value; }
            }
            public string Password
            {
                get { return _password; }
                set { _password = value; }
            }
            public IList<DisableRuleInfo> RuleList
            {
                get { return _list; }
                set { _list = value; }
            }
        }
        public class DisableRuleInfo
        {
            private string _n;
            private string _reg;
            private string _disablereason;
            public string Name
            {
                get { return _n; }
                set { _n = value; }
            }
            public string Regular
            {
                get { return _reg; }
                set { _reg = value; }
            }
            public string DisableReason
            {
                get { return _disablereason; }
                set { _disablereason = value; }
            }

        }

就是上面这个情况,如何序列化后做为xml文档保存呢 --------------------编程问答-------------------- 补充一下configinfo序列化 --------------------编程问答-------------------- 从IList<DisableRuleInfo> 派生一个类出来作为RuleList的类型,序列化可以自己实现IXMLSerializable来做 --------------------编程问答-------------------- 不懂也要帮顶……
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,