- Code: Select all
foreach (var Product in ProductsDictionary.Values)
{
var TextFinds = Doc.Pages[0].FindText(Product.Name).Finds;
... do stuff with TextFinds[0]...
// TextFinds = null;
}
This is the meat of what I'm trying to accomplish. I'm finding that TextFinds[0] always contains the same PDFTextFind object that was found on the first iteration on this loop, even though that TextFinds is a local variable for that loop instance only. Setting TextFinds to null at the end of the loop results in the same error. I have ~26k items in ProductsDictionary, so this is causing an ArgumentOutOfRange to be thrown and all code proceeding the foreach loop to stop executing.
What is causing this, and what can be done so that on each loop iteration, I'm working with an empty FindCollection object?