J
John
How come something like this is not legal?
public class myRec
{
public string Name = "";
public string Address = "";
public bool Update = false;
}
BinaryWriter outStream = new BinaryWriter(new FileStream("file.dat",
FileMode.Create));
myRec mRec = new myRec();
mRec.Name = data.name;
mRec.Address = data.address;
mRec.Update = data.update;
outStream.Write(mRec);
I get the following errors
Error 1 The best overloaded method match for
'System.IO.BinaryWriter.Write(bool)' has some invalid arguments
C:\code\Form1.cs 90 13 File1
Error 2 Argument '1': cannot convert from 'File1.Form1.NodeRec' to 'bool'
C:\code\Form1.cs 90 27 File1
I am assuming that I have to add one value at a time to the writer (which
works),
then write it out to the stream instead of just trying to write the class to
the stream.
John
public class myRec
{
public string Name = "";
public string Address = "";
public bool Update = false;
}
BinaryWriter outStream = new BinaryWriter(new FileStream("file.dat",
FileMode.Create));
myRec mRec = new myRec();
mRec.Name = data.name;
mRec.Address = data.address;
mRec.Update = data.update;
outStream.Write(mRec);
I get the following errors
Error 1 The best overloaded method match for
'System.IO.BinaryWriter.Write(bool)' has some invalid arguments
C:\code\Form1.cs 90 13 File1
Error 2 Argument '1': cannot convert from 'File1.Form1.NodeRec' to 'bool'
C:\code\Form1.cs 90 27 File1
I am assuming that I have to add one value at a time to the writer (which
works),
then write it out to the stream instead of just trying to write the class to
the stream.
John