ralphtrent
Programmer
Hello
I have an app that list folders matching some naming critera. I saved the folder paths to a List<System.IO.DirectoryInfo> object. I allow the user to delete folders of their choosing's. When they do, I need to remove the folder from the list. Obviously its not working.
Here is my code to remove
It looks like the two list are not sorted in the same order and I think that is whats screwing me up when I go to remove.
Any idea on what I am doing wrong?
Thanks,
RalphTrent
I have an app that list folders matching some naming critera. I saved the folder paths to a List<System.IO.DirectoryInfo> object. I allow the user to delete folders of their choosing's. When they do, I need to remove the folder from the list. Obviously its not working.
Here is my code to remove
Code:
System.Collections.Generic.List<System.IO.DirectoryInfo>
pFolders.Add(new System.IO.DirectoryInfo(dgrv.Cells["FolderPath"].Value.ToString()));
[green]// The results are displayed in a DataGridView with checkboxes for each row. If the row is check, i add it to pFolder
[/green]
pFolders = new List<System.IO.DirectoryInfo>();
foreach (System.IO.DirectoryInfo dir in pFolders)
{
if (!dir.Exists)
{
[green]//gglSelectedFolderList is myList<>
[/green]gglSelectedFolderList.Remove(gglSelectedFolderList.Find(removeUncheckedFolder));
}
}
[green]// Here is my predicate [/green]
private bool removeUncheckedFolder(System.IO.DirectoryInfo dir)
{
if (!dir.Exists)
{
return true;
}
else
{
return false;
}
}
It looks like the two list are not sorted in the same order and I think that is whats screwing me up when I go to remove.
Any idea on what I am doing wrong?
Thanks,
RalphTrent