----------------------------
[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);
//这样写好像不行
}
}
[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);
//这样写好像不行
}
}
解决方案 »
- 做一个网址收藏夹,用XML存储
- 请熟悉数据库的都进来看看!
- windows mobile 怎样将 dataset转换成二进制BYTE[]类型数据???
- 编写C#,你用的是VS2005还是VS2008或者其他的
- double.TryParse("1234,34,49",out temp)为True,不解?
- 比如一个链表,还有树和图之类的要借助于指针或者引用来实现的数据结构,在c#里面怎么实现呢?
- 使用socket收邮件出现的编码问题?
- 各位,俺想问下,XML其实在你们做项目过程中用得多吗?主要是用作什么用途???
- 事件委托-----------------------
- 如何在DataGrid的CurrentCellChanged事件中获取焦点移动前的Cell?
- vs2005安装问题
- DetailsView 调整列宽
{
BLLInfo = (CaseDetailBLLInfo)info.GetValue("BLLInfo", typeof(CaseDetailBLLInfo));
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("BLLInfo", BLLInfo, typeof(CaseDetailBLLInfo));
}答案很简单,只是俺是个初学者,开始不知道 typeof() 这个函数 ,汗啊..