using System.IO; FileStream fileStream = new FileStream("example.txt", FileMode.Append); fileStream.WriteByte(65); fileStream.Close();
using System.IO; byte[] byteArray = new byte[] { 65, 66, 67, 68 }; FileStream fileStream = new FileStream("example.txt", FileMode.Append); foreach(byte b in byteArray) { fileStream.WriteByte(b); } fileStream.Close();In this example, a byte array containing four elements is created. The file stream is opened in append mode, and the WriteByte method is called in a loop to write each byte from the array to the file stream. The package library used in this code is "System.IO".