C# 求WINCE实现对象序列化BinaryFormatter的方法,有没办法在CE下把类写成一个文件?
下面代码中在WIN7下通过 但是转到智能平台开发 CE的下面 就没有BinaryFormatter的方法
Student objStu = new Student()
{
Name = this.txtName.Text.Trim(),
Age = Convert.ToInt16(this.txtAge.Text.Trim()),
Gender = this.txtGender.Text.Trim(),
Birthday = Convert.ToDateTime(this.txtBirthday.Text.Trim())
};
//【1】创建文件流
FileStream fs = new FileStream("C:\\objStu.obj", FileMode.Create);
//【2】创建二进制格式化器
BinaryFormatter formatter = new BinaryFormatter();
//【3】调用序列化方法
formatter.Serialize(fs, objStu);
//【4】关闭文件流
fs.Close();