.NET

Reply
Contributor
martinduke2653
Posts: 19
Registered: ‎12-04-2005
Message 1 of 4 (205 Views)

GetEnumerator in DBDictionary

205 Views, 3 Replies
09-18-2006 05:45 PM
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
*Tony Tanzillo
Message 2 of 4 (205 Views)

Re: GetEnumerator in DBDictionary

09-19-2006 12:57 AM 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
Contributor
martinduke2653
Posts: 19
Registered: ‎12-04-2005
Message 3 of 4 (205 Views)

Re: GetEnumerator in DBDictionary

09-19-2006 05:39 AM in reply to: martinduke2653
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.
*Tony Tanzillo
Message 4 of 4 (205 Views)

Re: GetEnumerator in DBDictionary

09-19-2006 05:29 PM 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.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.