在C#中否定字符串

Mat*_*att 0 c# string negate

我正在编写一个简单的文件夹观察程序,我想忽略一个temp.temp文件,该文件在扫描时被复制到文件夹中,因此程序将检测放在文件夹中的任何内容并忽略temp.temp文件.目前我已经有程序检测IMG文件来解决问题.

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

fox*_*oxy 7

如果e是类型FileInfo,那么你可以使用

if(e.FullPath.Contains("IMG") && e.Name.Equals("temp.temp", StringComparison.CurrentCultureIgnoreCase))
{ 
    MessageBox.Show("You have a Collection Form: " + e.Name);
    Process.Start("explorer.exe", e.FullPath);
}
Run Code Online (Sandbox Code Playgroud)