How can i do re coding without assign null value?

Posted by Phsika on Stack Overflow See other posts from Stack Overflow or by Phsika
Published on 2010-06-16T14:19:32Z Indexed on 2010/06/16 14:22 UTC
Read the original article Hit count: 200

How can i do below without assign null value "Tex=null"?

   static void Main(string[] args)
        {
            FileInfo f = new FileInfo("C:/temp/Arungg.txt");
            StreamWriter Tex;
            Tex = null;
            if (!f.Exists)
            {
                f.CreateText();
            }
            else
            {
                Tex = f.AppendText();
            }
                Tex.WriteLine("Test1");
                Tex.WriteLine("Test2");
                Tex.Write(Tex.NewLine);
                Tex.Close();
                Console.WriteLine(" The Text file named Arungg is created ");


        }

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET