I am wondering about ideas on writing some Library code for handling SymbolTables.
The issue explained in quote below from
HereWhen a symbol table contains multiple entries with the same name, all except
one of which are erased, Has() returns true regardless of whether the first
entry it finds is erased or not, and the default indexer returns the first
entry it finds, erased or not.
They have changed the indexer behaviour not sure when it changed but think they changed it in 2011 or 2012
For a little info on the subject
I could be wrong be looking at it in reflector the indexer method for 2007 uses
AcDbBlockTable::getAt and the argument for
getErasedRec is always
true.
So would return first record it found erased or not.
In 2013 they use a private field for the
getErasedRec argument.
When a managed wrapper is created for a SymbolTable is assigns a private field that will pass
false for
getErasedRec argument in the
indexer method. The
SymbolTable IncludingErased property calls its Copy method which creates another managed wrapper and changing the field to pass true for the getErasedRec argument.
The
SymbolTable Has method like earlier releases returns true if it contains one unerased record.
So halfway there and would be nice if acted like quote below from above link
The way it should have been done, is to have both Has() and the default
indexer ignore erased entries, unless they are invoked on the copy of the
SymbolTable that's returned by the IncludingErased property.
You could write a Has extension method that has a another bool parameter to return true if it contains at least one record erased or not, but pretty much defeats the purpose.
Any ideas on knowing if you working with a default SymbolTable or a copy returned from
IncludingErased property?