private void TryToDeleteCachedImages()
{
//operate on a copy to avoid "Collection was modified; enumeration operation may not execute"
//if someone is still using use while we're being disposed
var pathsToDelete = new List<string>();
pathsToDelete.AddRange(_paths.Values);
foreach (var path in pathsToDelete)
{
try
{
if (File.Exists(path))
{
File.Delete(path);
Debug.WriteLine("LowResImageCache Successfully deleted: " + path);
}
}
catch (Exception e)
{
Debug.WriteLine("LowResImageCache Dispose(): " + e.Message);
}
}
_paths = null;
}