Dispose a StreamWriter by using 'using' : Using Statement : File Directory Stream C# Examples


C# Examples » File Directory Stream » Using Statement »

 

Dispose a StreamWriter by using 'using'









    
using  System;
using  System.IO;

public  sealed  class  MainClass
{
        static  void  Main(){
                using(  StreamWriter  sw  =  new  StreamWriter("Output.txt")  )  {
                        sw.WriteLine(  "This  is  a  test  of  the  emergency  dispose  mechanism"  );
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo File Directory Stream
» Using Statement