.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GetEnumerator in DBDictionary

3 REPLIES 3
Reply
Message 1 of 4
martinduke2653
606 Views, 3 Replies

GetEnumerator in DBDictionary

Hello All,

I have a custom dictionary attached to a drawing into which I have several Xrecords attached, each with a different name. I am trying to find a way to get the name of each Xrecord out of the dictionary and into an array. The GetAt function assumes you know the name, so that's no use. Then I thought maybe use the GetEnumerator function but DBDictionaryEnumerator doesn't seem to be exposed! Can any one offer any advice?

Regards

Martin Duke
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: martinduke2653

It helps to use the object browser, because it will
show you what interfaces a given object supports.

DBDictionary supports the IDictionary interface,
which means:

DBDictionary dict = // assign to a DBDictionary

string[] names = new string[dict.Count];

((IDictionary) dict).Keys.CopyTo(names, 0);

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5333385@discussion.autodesk.com...
Hello All,

I have a custom dictionary attached to a drawing into which I have several Xrecords attached, each with a different name. I am trying to find a way to get the name of each Xrecord out of the dictionary and into an array. The GetAt function assumes you know the name, so that's no use. Then I thought maybe use the GetEnumerator function but DBDictionaryEnumerator doesn't seem to be exposed! Can any one offer any advice?

Regards

Martin Duke
Message 3 of 4

Hi Tony,

Thanks for that!

I ended up solving it this way after a friend pointed out that dictionaryEntry was another way to go.

Dim DE As DictionaryEntry
ReDim keywords(dbdict.count-1)
For Each DE In DictObj
keywords(i1) = de.key
i1 = i1 + 1
Next

Cheers

Martin.
Message 4 of 4
Anonymous
in reply to: martinduke2653

Yep. But, of course that's the 'scenic' route 🙂

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5333683@discussion.autodesk.com...
Hi Tony,

Thanks for that!

I ended up solving it this way after a friend pointed out that dictionaryEntry was another way to go.

Dim DE As DictionaryEntry
ReDim keywords(dbdict.count-1)
For Each DE In DictObj
keywords(i1) = de.key
i1 = i1 + 1
Next

Cheers

Martin.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost