using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.IO;

namespace ThreadLibrary
{
   public class FileIO
   {
      public static int i = 0;

      public void WriteToFile()
      {
         try
         {
            Interlocked.Increment(ref i);

            Console.WriteLine(i.ToString());
         }
         catch (IOException e)
         {
            Console.WriteLine(e.ToString());
         }
         finally
         {
            //abschließende Arbeiten
         }
      }
   }
}