Hi all. Sorry for my bad English.
The dictionary of the identifiers grouped by types is necessary to me. If in a cycle each time I will check dictionary key existence (look a code below), then the code will be slower. I want to receive at first all keys, to add them in the dictionary, and only after that to take identifiers and to group them by dictionary keys. Look my commented code row:
...
Dictionary<string, List<ObjectId>> dict = new Dictionary<string, List<ObjectId>>();
using (Transaction t = Database.TransactionManager.StartTransaction()) {
for (long i = Database.BlockTableId.Handle.Value; i < Database.Handseed.Value; i++) {
ObjectId id = ObjectId.Null;
Handle h = new Handle(i);
if (IsValidHandle(h, ref id) && filter(t, id)) {
string type = id.ObjectClass.Name;
if (!dict.Keys.Contains(type))// <= My question about it code row - it isn't pleasant to me...
dict.Add(type, new List<ObjectId>());
dict[type].Add(id);
}
}
t.Abort();
}
...
How can I to get the list of all types which objects are available in a drawing database?