namespace BinaryFileIO
{

    class Program
    {







        static void Main()
        {

            FileStream BinFile = new FileStream("BinFile.bin", FileMode.Create, FileAccess.Write);
            BinaryFormatter bformatter1 = new BinaryFormatter();
         //right to file
            Random rng = new Random();
             for (int i = 0; i < 10; i++)

                {
                   // how  do i put to the file and than read from it to console????


                }

             BinFile.Close();
                 //reads to console,but not from file
             FileStream BinFile2 = new FileStream("BinFile.bin", FileMode.Open, FileAccess.Read);
             for (int i = 0; i < 10; i++)
             {

                 Console.WriteLine(rng.Next(1, 101));

             }


            Console.ReadKey();



        }
    }
}

Hi

What type of data do you want to write to the file and read later on?

Discribe your problem in detail. To put what to the file?