From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create .net Dictionary

Solved!
Go to solution

Hi,

 

I would like to create a .NET Dictionary object in Labview.

C# code is "Dictionary<int, List<string>> segmentBodies = new Dictionary<int, List<string>>();"

 

I'm able to create a List<string> as done here, but cannot create a Dictionary.

 

I'm aware that Labview doesn't support generics, but if possible I would like to create it in the same way as the List can be created.

 

Thanks for the help.

0 Kudos
Message 1 of 3
(3,861 Views)

It might be possible - you have to know the CLR-generated type names for List<string> and Dictionary<int, List<string>>. 

 

An idea - create a quick C# console application, create a new instance of your Dictionary and then print the actual Type name to the Console. This shiould give you a head start as to the generated name. Or you could guess it based on this (https://msdn.microsoft.com/en-us/library/w3f99sx1(v=vs.110).aspx)

 

If this doesn't work then my advice is to create a basic C# wrapper assembly around the Dictionary. This is probably the most maintainable option as you can limit your exposure.

0 Kudos
Message 2 of 3
(3,828 Views)
Solution
Accepted by topic author andrej

After checking all options I decided to go with the C# wrapper. I think that at the end it's the best and easiest option.

Message 3 of 3
(3,798 Views)