WriteByteメソッドを使うと、Streamにデータを1バイトずつ書き込むことができます。
WriteByteメソッドを使ってStreamに1バイトずつデータを書き込む
using System;
using System.IO;
class Sample {
static void Main()
{
using (var stream = File.OpenWrite("sample.dat")) {
// 書き込むデータが格納されているバイト配列
var data = new byte[8] {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48};
for (var index = 0; index < data.Length; index++) {
// streamに1バイトずつ書き込む
stream.WriteByte(data[index]);
}
}
}
}