Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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.");
        }
Comment

PREVIOUS NEXT
Code Example
Csharp :: httprequestmessage with authorization .net 5 
Csharp :: asp net identity login failed for user 
Csharp :: mesh data optimization resolving used channels 
Csharp :: CS0176 
Csharp :: ASP.Net MVC 5 datalist event trap to perform action 
Csharp :: how to twist a image in the code behind C# 
Csharp :: wpf user parent controller datacontext 
Csharp :: How to do a comment in c# 
Csharp :: Jeng InitDb 
Csharp :: what is the default value for an enum c# 
Csharp :: ascii art american flag 
Csharp :: mock return exception c# 
Csharp :: make tooltip disappear c# 
Csharp :: log4net rollingfileappender c# 
Csharp :: you have the following c# code. stringbuilder sb = new stringbuilder(really long string); the really long string variable is a string in which a very long string is stored. 
Csharp :: how to convert command line argument to int in C# 
Csharp :: mouse position to canvas transform 
Csharp :: leantween unity when timescale 0 
Csharp :: how to add the ssl certificate in vb.net application 
Csharp :: in model add to give drop down message 
Csharp :: reversing linkedlist C# 
Csharp :: change color unity back and forth 
Csharp :: c# class reference 
Csharp :: unity c# store gameobject in array 
Csharp :: c# read only file used by other app 
Csharp :: entity framework dynamic search 
Csharp :: AutoFixture ignore property 
Csharp :: tuples in c# 
Csharp :: c# validate username and password 
Csharp :: unity using tmpro not working 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =