I have a function that checks for presence of files in a particular folder and if the files have the data that is not present in the main database i write that data to main db and delete the file i am using Directory.EnumerateFiles to get the list of files and then i iterate through this list to check if they are present in the db, i want to return from the function if the list is empty how to check if list that i got is empty,if i debug and the folder has no files it shows Enumeration did not produce the results.
private void GetListOfFiles()
{
string sourceDirectory = pathOfXmlFiles;
if (!Directory.Exists(sourceDirectory))
{
return;
}
var xmlFiles = Directory.EnumerateFiles(sourceDirectory, "*.xml");
foreach (var item in xmlFiles)
{
ReadXmlFile(item);
}
foreach (var item in xmlFiles)
{
if (_writtenToDb)
{
File.Delete(item);
}
}
}
i check for the presence of these files using a different thread that has a timer that fires every 25 seconds , i never do stop the timer can this lead to memory leaks?