Inventor Engineer-to-Order

Reply
Board Manager
Jon.Balgley
Posts: 243
Registered: ‎08-23-2006
Message 1 of 2 (144 Views)
Accepted Solution

Using System...Dictionary from Intent

144 Views, 1 Replies
10-11-2012 03:39 PM

In this morning's "ETO Potlatch", Farren asked about using a System.Dictionary.  Here is a simple example.  Note that you cannot use "New", but you have to use CreateInstance.

 

Uncached Rule TestDictionary As List
   Dim map As Any = System.Activator.CreateInstance("mscorlib", "System.Collections.Generic.Dictionary`2[System.Int32,System.String]").UnWrap()
   map.Add(3, "Hello")
   map.Add(42, "Goodbye")
   Dim intentList As List
   Dim kv As Any
   For Each kv In map
     intentList = intentList + {kv.Key, kv.Value }
   Next
   
   Dim retList As List
   If (map.ContainsKey(3)) Then
     retList = retList + { map.get_Item(3) }
   End If
   
   Return retList
End Rule

 Thanks Mike!

 

 



Jon Balgley
Autodesk Configurator 360 / Inventor ETO team
Autodesk, Inc.

Mentor
FarrenYoung
Posts: 263
Registered: ‎07-13-2009
Message 2 of 2 (130 Views)

Re: Using System...Dictionary from Intent

10-11-2012 03:58 PM in reply to: Jon.Balgley

Awesome!  If only I had asked this question sooner. :-p

 

Thanks for this

--Farren

************************************************************************************
If this post helps, please click the "thumbs up" to give kudos
If this post answers your question, please click "Accept as Solution"
************************************************************************************

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube