惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
MyScale Blog
MyScale Blog
爱范儿
爱范儿
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
美团技术团队
Y
Y Combinator Blog
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
Martin Fowler
Martin Fowler
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
M
MIT News - Artificial intelligence
博客园 - Franky
V
Visual Studio Blog
I
InfoQ
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
博客园 - 司徒正美
L
LangChain Blog

博客园 - shcity

Troubleshooting on TransactionScope Parse string to JSON object Parse date in js blockUI doesn't close when download file in asp.net define namespace in JS Dense_Rank(), Row_Number(), Rank() in sql server reading and writing variable through lock in SSIS script task Fix the issue that cannot open SSIS in BIDS three ways creating custom helpers to show RadioButtonList in MVC using JavaScriptSerializer to serialize object to json ViewStateAutoManager ReportingService formatting Build my own DataTable split a string into an array through comma div with separated html template - shcity 正则表达式替换日期 半透明的div对话框 foreach 的自动转化类型 在Ajax1.0中调用页面CS文件中的方法
using ISerializable to control serialization and deserial...
shcity · 2012-03-05 · via 博客园 - shcity

[Serializable]
    public class OuterClass : ISerializable
    {
        public OuterClass()
        {
        }

        private OuterClass(SerializationInfo info, StreamingContext context)
        {
            MyField = info.GetString("MyField");
            Inner = (InnerClass)info.GetValue("Inner"typeof(InnerClass));
        }

        #region ISerializable Members

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("MyField", MyField);
            info.AddValue("Inner",Inner);
        }

        #endregion

        public string MyField { getset; }

        public InnerClass Inner { getset; }
    }

    [Serializable]
    public class InnerClass : ISerializable
    {
        public InnerClass()
        {
        }

        private InnerClass(SerializationInfo info, StreamingContext context)
        {
            MyField = info.GetString("MyField");
        }

        #region ISerializable Members

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("MyField", MyField);

        }

        #endregion

        public string MyField { getset; }
    }

posted on 2012-03-05 09:41  shcity  阅读(191)  评论()    收藏  举报