----------------------------
[Serializable]
public class ClassA
{
    private int a;
    public int b;
    ......
}
--------------------------------
//ClassB 类中 存在有一个 ClassA 的变量
//ClassB 的序列化和反序列化的过程只要求
//保存和还原 ClassA 变量的内容就可以,其他的不需public class ClassB : Control, ISerializable
{
    public b(){}    protect b(SerializationInfo info, StreamingContext context)
    {
      //这里应该怎么实现?
    }
    private ClassA _AInfo;
    public ClassA AInfo{
       get {return _AInfo;}
    }
    public void GetObjectData(SerializationInfo info, StreamingContext context)
    {
         //这里该怎么写?
         //info.AddValue("BLLInfo", BLLInfo);
         //这样写好像不行
    }
}

解决方案 »

  1.   

            protected CaseDetailBLL(SerializationInfo info, StreamingContext context)
            {
                BLLInfo = (CaseDetailBLLInfo)info.GetValue("BLLInfo", typeof(CaseDetailBLLInfo));
            }
            public void GetObjectData(SerializationInfo info, StreamingContext context)
            {
                info.AddValue("BLLInfo", BLLInfo, typeof(CaseDetailBLLInfo));
            }答案很简单,只是俺是个初学者,开始不知道 typeof() 这个函数 ,汗啊..