Use FileStream inside a using statement : Using Statement : File Directory Stream C# Examples


C# Examples » File Directory Stream » Using Statement »

 

Use FileStream inside a using statement









    
using  System;
using  System.IO;
using  System.Text;

public  class  MainClass
{
        static  void  Main()  {
                using(  FileStream  fs  =  File.Open(  "log.txt",  FileMode.Append,  FileAccess.Write,  FileShare.None  )  )  {
                        Byte[]  msg  =  new  UTF8Encoding(true).GetBytes("string  \n");
                        fs.Write(  msg,  0,  msg.Length  );
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo File Directory Stream
» Using Statement