dcx0026 :你好,我是把窗体序列化,不是对类进行序列化,我的代码请你给我分析一下:
insForm = new Form();
insForm.Show();
//MEABlock myBlock =new MEABlock();
// Insert code to set properties and fields of the object.
myBlock.Caption = "aaaa000000000000000";
myBlock.m_ID = 000000000;
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream("D://MyFile.bin", FileMode.Create, FileAccess.Write, FileShare.None);
formatter.Serialize(stream, insForm );
//出错,提示:程序集“System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”中的类型“System.Windows.Forms.Form”未标记为可序列化。
怎么才能解决,谢谢.
stream.Close();