Input/Output 14: BinaryWriter
The BinaryWriter class is used to write binary data to a stream. You can construct a BinaryWriter object by passing a Stream object; you canï¿½t pass a file path to create a BinaryWriter object. In addition, there is also a parameterless constructor. The BinaryWriter classï¿½ most important method is Write. This method has 18 overloads that guarantee that you can write any type of data to a BinaryWriter object. For example, the following code creates a BinaryWriter object that is linked to a new file called MyBinary.bin, and writes a byte and a string:
BinaryWriter bw = new BinaryWriter(File.Create("
Byte b = 17;
string s = "August";
Feel free to comment this article using a facebook profile.
I'm using facebook accounts for identification since even akismet couldn't handle all the spam I receive every day.