0
我有2維分支數組。這我轉換爲一個對象,並通過序列化程序將其寫入文件。 (轉換爲序列化程序的對象原因,你知道) 現在我讀取這個文件並返回對象 - 但我怎樣才能將對象轉換回2d分枝數組?如何將對象轉換爲2維分支字符串數組
在此先感謝!
編輯:
// 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;
}
}
向我們展示目前的代碼。 – 2013-05-03 12:10:17