Using System...Dictionary from Intent

Using System...Dictionary from Intent

Jon.Balgley
Alumni Alumni
724 Views
1 Reply
Message 1 of 2

Using System...Dictionary from Intent

Jon.Balgley
Alumni
Alumni

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
Reply
Reply
Accepted solutions (1)
725 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

Awesome!  If only I had asked this question sooner. 😛

 

Thanks for this

Reply
Reply
0 Likes