BinaryWriter Problem for ValueTypes
-
Hi Guys, i want to write may value type(structure) in binary format, in BinaryWriter class, overloading is available for all CTS primitive types.But no overload for Object type. Is there facility is available for writing my value type....
//My Value Type struct MyData { string _name; string _fathername; string _address; }; using(BinaryWriter bn = new BinaryWriter(File.Open("File Path"), FileMode.OpenOrCreate))) { MyData d; d._name = nameTextbox.Text; d._fathername = fatherTextbox.Text; d._address = addressTextbox.Text; bn.Write(d) // Error }
Thanks in Advance -
Hi Guys, i want to write may value type(structure) in binary format, in BinaryWriter class, overloading is available for all CTS primitive types.But no overload for Object type. Is there facility is available for writing my value type....
//My Value Type struct MyData { string _name; string _fathername; string _address; }; using(BinaryWriter bn = new BinaryWriter(File.Open("File Path"), FileMode.OpenOrCreate))) { MyData d; d._name = nameTextbox.Text; d._fathername = fatherTextbox.Text; d._address = addressTextbox.Text; bn.Write(d) // Error }
Thanks in Advance -
Hi Guys, i want to write may value type(structure) in binary format, in BinaryWriter class, overloading is available for all CTS primitive types.But no overload for Object type. Is there facility is available for writing my value type....
//My Value Type struct MyData { string _name; string _fathername; string _address; }; using(BinaryWriter bn = new BinaryWriter(File.Open("File Path"), FileMode.OpenOrCreate))) { MyData d; d._name = nameTextbox.Text; d._fathername = fatherTextbox.Text; d._address = addressTextbox.Text; bn.Write(d) // Error }
Thanks in Advance