public MainObject(SerializationInfo info, StreamingContext context) { MessageBox.Show($"{DateTime.Now.ToString("HH:mm:ss.fff")}:Main 序列化开始"); ivalue = info.GetInt32("ivalue"); m_innerObj2 = (InnerObject1)info.GetValue("innerObject2", typeof(InnerObject1)); MessageBox.Show($"{DateTime.Now.ToString("HH:mm:ss.fff")}:加载InnerObj"); m_innerObj = (InnerObject)info.GetValue("innerObject", typeof(InnerObject)); dvalue = info.GetDouble("dvalue"); svalue = info.GetString("svalue"); MessageBox.Show($"{DateTime.Now.ToString("HH:mm:ss.fff")}:反序列化完成"); }
public MainObject() { m_innerObj = new InnerObject("obj1"); m_innerObj2 = new InnerObject1("obj2"); }