System IO C# by API

using System;
using System.IO;
public class Binary {
  public static void Main(string [] args) {
    BinaryWriter output = new BinaryWriter(new FileStream("test.dat",FileMode.Create));
    
    output.Write(1);
    
    output.Write(0.01);
   
    output.Close();
    BinaryReader input = new BinaryReader(new FileStream("test.dat",FileMode.Open));
    Console.WriteLine("{0} ", input.ReadInt32());
    Console.WriteLine("{0:F1} ", input.ReadDouble());
    input.Close();
  }
}