P
Peter Morris
I remember a post similar to this but cannot find it.
I have
List<string> fileNamesToDelete;
List<SomeObject> objectsToSend;
Let's say fileNamesToDelete has 1,000 items in it, and objectsToSend has 990
items in it. What I want to do is something like this
fileNamesToDelete = fileNamesToDelete.Where(fn =>
!fileNamesToDelete.Contains(fn)).ToList();
But the .Contains is going to be slow. I can create a dictionary<string,
object> to hold the fileNamesToDelete, but I remember there was a LINQ way
of doing this which probably used a dictionary internally anyway. Can
someone remind me what that approach is?
Thanks
I have
List<string> fileNamesToDelete;
List<SomeObject> objectsToSend;
Let's say fileNamesToDelete has 1,000 items in it, and objectsToSend has 990
items in it. What I want to do is something like this
fileNamesToDelete = fileNamesToDelete.Where(fn =>
!fileNamesToDelete.Contains(fn)).ToList();
But the .Contains is going to be slow. I can create a dictionary<string,
object> to hold the fileNamesToDelete, but I remember there was a LINQ way
of doing this which probably used a dictionary internally anyway. Can
someone remind me what that approach is?
Thanks