Code:
String firstname;
String myoutline;
Console.Write("Enter Your First Name:");
firstname = Convert.ToString(Console.ReadLine());
string path = @"file.txt";
myoutline = firstname;
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(myoutline);
}
}
Console.ReadKey();