Answers for "create file empty c#"

C#
0

how to create empty text file in c#

using (File.Create(filename)) ;
Posted by: Guest on October-02-2020
0

c# create empty file if not exists

string temp = AppDomain.CurrentDomain.BaseDirectory;
			string sPath = Path.Combine(temp, "file.txt");

bool fileExist = File.Exists(sPath);
        if (fileExist) {
            Console.WriteLine("File exists.");
        }
        else {
          using (File.Create(sPath)) ;
            Console.WriteLine("File does not exist.");
        }
Posted by: Guest on September-18-2021

C# Answers by Framework

Browse Popular Code Answers by Language