I have an ArrayList of FileInfo objects. Let's say I have a file object with a FullName of c:\temp\x1234.log and I want to know if a file with the same name is already in my ArrayList (but not necessarily with the same Full Name path...I ONLY want to know if it has the same file name). Is there a way to do that other than something like this (see code), which requires me to loop through the ArrayList to compare every file I want to search for. I'm hoping there's a less CPU intensive way to perform the task.
Dim c As Integer = DestinationFileList.Count
For i As Integer = 0 To c - 1
If DestinationFileList.Item(i).Name.ToString = CurrentFileInfo.Name.ToString Then
If DestinationFileList.Item(i).LastWriteTime <= CurrentFileInfo.LastWriteTime Then
fileAlreadyExists = True