Search code examples
c#stringnegate

Negate a string in C#


Im writing a simple folder watcher program, I would like to ignore a temp.temp file that gets copied into the folder when a scan is made, so the program will detect anything placed in the folder and ignore the temp.temp file. At the moment I have got the program detecting IMG files to get around the problem.

if(e.FullPath.Contains("IMG"))            
{ 
    MessageBox.Show("You have a Collection Form: " + e.Name);
    Process.Start("explorer.exe", e.FullPath);
}

Solution

  • Try : If(!e.FullPath.EndsWith("temp.temp"))