find and solve ||
Please wait.....

How to use C# BinaryWriter Class

In the C#, BinaryWriter is a class of System.IO namespace which is sworks at lower level of Streams. It is using for write primitive types as binary values in a specific encoding stream.

C# BinaryWriter Example

using System;  
using System.IO;
namespace BinaryWriterExample {
   public class Program
        static void Main(string[] args)
            string fileName = "d:\\test.dat";
            using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create)))
                writer.Write("this is string data");
            Console.WriteLine("Data written successfully...");


Data written successfully...

Related information