I want to check for the existence of a table with a given ID in a word document in C# (VS 2008) Visual Studio Tools for Office (version 3).
Obviously I can iterate through the document's Tables collection and check every ID, but this seems inefficient; the document will end up having a few dozen tables after I'm done with it, and while I know that's not a lot, looping through the collection seems sloppy. The Tables collection is only indexed by integer id, not by the string ID assigned to the table, so I cant just use an index, and there's no apparent Exists method of the document or tables collection.
I thought of casting the Tables collection to an IQueryable using AsQueryable(), but I don't know how to go about doing this in such a way that I could query it by ID.
Pointers to docs or sample code would be appreciated, or if there's a better way to go about it, I'm all for that, too