我有一个二维分支数组。我将其转换为对象并通过序列化程序将其写入文件。(序列化程序转换为对象的原因,你知道)现在我读取了这个文件并取回了对象 - 但是我如何能够将对象转换回二维分支数组?
提前致谢!
编辑:
// read object
SerializedObjectRead sr = new SerializedObjectRead();
sr.FileStreamName = @"E:\LOG\test.bin";
int intSuccesfullR = sr.Reader();
object back = new object();
if (intSuccesfullR == 0)
{
back = sr.ReadObj;
}
// here i want to convert the object to the 2d array
// my reader class
public class SerializedObjectRead
{
public string FileStreamName;
public object ReadObj;
public int Reader()
{
int intSuccesfull = 0;
try
{
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(FileStreamName, FileMode.Open, FileAccess.Read, FileShare.Read);
ReadObj = formatter.Deserialize(stream);
stream.Close();
}
catch
{
intSuccesfull = -1;
}
return intSuccesfull;
}
}