using System; using System.IO; class Program { static void Main(string[] args) { using (FileStream fs = new FileStream("file.bin", FileMode.Create)) { using (BinaryWriter bw = new BinaryWriter(fs)) { bw.Write("Hello World"); bw.Close(); } } } }
using System; using System.IO; class Program { static void Main(string[] args) { MemoryStream ms = new MemoryStream(); using (BinaryWriter bw = new BinaryWriter(ms)) { bw.Write("Hello World"); } ms.Close(); } }This example shows how to use the BinaryWriter.Close() method to close the binary writer after writing some data to a MemoryStream. Package Library: System.IO.FileSystem.
public Close ( ) : void | ||
return | void |