View Single Post
Old 01-18-2009, 02:38 PM   #1 (permalink)
BobLewiston
 
Junior Techie

Join Date: Nov 2008

Posts: 79

BobLewiston is on a distinguished road

Default finding text files in C# console applications

In C# console applications, isn't there a simpler way than handling exceptions to just find out if a text file of a given name exists in the current directory? I'm talking about something along the same lines as the following methods:

create text file:
Code:
StreamWriter SW = File.CreateText ("MyFile.txt");
open existing text file:
Code:
StreamReader SR = File.OpenText ("MyFile.txt");
append to text file:
Code:
StreamWriter SW  = File.AppendText ("MyFile.txt");

BobLewiston is offline