CS1061 'bool' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'bool' could be found (are you missing a using directive or an assembly reference?)
So I am making here a search code to find 2 files named "Withdrawal" and Payment but not containing.XXXX wherein XXXX is HHmm (time). What probably the best thing to do because I am having an error with this ( I am not a developer just trying and pasting what I've searched)
string FolderPath = @"C:\Test";
DirectoryInfo di = new DirectoryInfo(FolderPath);
var files = di.EnumerateFiles("*.txt")
.Where(s => s.Name.Contains("Withdrawal"+"payment")
|| !s.Name.Contains("."+DateTime.Now.ToString("HHmm")).ToList());
var Currentfile1 = files[0].FullName;
var Currentfile2 = files[1].FullName;
you used .ToList()
in a bad place, just update your code as below for resolving your error:
var files = di.EnumerateFiles("*.txt")
.Where(s => s.Name.Contains("Withdrawal"+"payment") ||
!s.Name.Contains("."+DateTime.Now.ToString("HHmm")))
.ToList();