序列化 Region 继承Region,实现iSerializable接口 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 但是我不知道Region内部的数据结构!还望高手进一步指导! 大概是这样的: public class SerializableRegion:ISerializable { private Region _region=null; public SerializableRegion(Region region) { if(region==null) throw new ArgumentNullException(); } public Region Region { get{return this._region;} } public SerializableRegion (SerializationInfo info, StreamingContext context) { byte[] bytes=(byte[])info.GetValue("Data",typeof(byte[])); ConstructorInfo constructInfor=typeof(RegionData).GetConstructor(new Type[]{typeof(byte[])}); RegionData data=(RegionData)constructInfor.Invoke(new object[]{bytes}); this._region=new Region(data); } public void GetObjectData(SerializationInfo info, StreamingContext context) { RegionData data=this.Region.GetRegionData(); info.AddValue("Data",data.Data); } } c# 如何判断checkboxlist的某一项被选中,并取出值。 如何将大文件分块保存到Oracle中 关于QQ登录相关问题 winform 如何实现在子控件中清除自身,并加载另外的子控件? 注册表问题!!!在线等 .net高级群 关于cas单点登录 给人民币:请作一个HTML编辑器 关于ODBC调用存储过程获取return值 显示dll中的form 我保持了好久的第一次在这里没了。。。。呜呜。。。。。 是不是.net的bug阿,感兴趣的可以试试看
还望高手进一步指导!
public class SerializableRegion:ISerializable
{
private Region _region=null;
public SerializableRegion(Region region)
{
if(region==null)
throw new ArgumentNullException();
}
public Region Region
{
get{return this._region;}
}
public SerializableRegion (SerializationInfo info, StreamingContext context)
{
byte[] bytes=(byte[])info.GetValue("Data",typeof(byte[]));
ConstructorInfo constructInfor=typeof(RegionData).GetConstructor(new Type[]{typeof(byte[])});
RegionData data=(RegionData)constructInfor.Invoke(new object[]{bytes});
this._region=new Region(data);
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
RegionData data=this.Region.GetRegionData();
info.AddValue("Data",data.Data);
}
}