LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Template .NET Constructors

Is there any way to create a .NET object from a templated constructor, such as System.Collections.Generic.LinkedList<T> of System (2.0.0.0)?

When I create the .NET constructor node and browse for the class, I see that any class name that is a template base is followed by the text `1 or `2, which agrees with how many template parameters that are there to be filled in.  However, the constructor box in the diagram has no additional points to specify these data types.

Running the code with this box gives: "Cannot create an instance of System.Collections.Generic.LinkedList`1[T] because Type.ContainsGenericParameters is true.", which seems consistent since I haven't told it what type to store.

This is with 7.1.1f2.  I notice that with 8.0, I cannot even instantiate anything with the System.Collections.Generic (this layer doesn't even show up) from System (2.0.0.0).


0 Kudos
Message 1 of 6
(3,186 Views)
We don't support generics at this time in LabVIEW. The reason they showed up in f2 was a bug, and in LV 8 we correctly filter them out of the list of choices.
Message 2 of 6
(3,176 Views)
That's what I figured, would have made something simplier but have a workaround.

Do you know if there is going to be support for this in a future LV release, out of curiousity? 
0 Kudos
Message 3 of 6
(3,165 Views)
Well, I can say that we are definately going to add support for generics, but I'm afraid I can't give any timelines. There is a lot of support we still want to add for various .NET features and ease-of-use that don't include generics, so getting everthing bucketed into various releases is a challenge. Also, let me make a couple of personal definitions
 
1. An open generic is one that can be defined for any type, such as LinkList<T>
 
2. A closed generic is one that is locked to a specifc type, such as LinkList<int>
 
Obviously, #2 assumes that there is some .NET code that has defined such a type, for example as a factory method or a property.
 
I can say you'll be seeing support for #2 earlier than support for #1 (i.e., planned for the release of LabVIEW code named Europa), simply because of the amount of work involved. I say "planned" because you know how software is, you never know what can happen, and so I hate to make promises. But I'm expecting it to be there. Also, I can't say when Europa is planned to ship, because we don't give that information out until the product is formally announced.
 
I'm not sure if that helps any, but I thought I'd share it in case it did.
Message 4 of 6
(3,157 Views)
Is what is and what is not supported by LabVIEW for .NET documented anywhere?  I've been trying to return a generic Dictionary datatype in my code for several hours now.  Knowing what is and what is not supported by LabVIEW with respect to .NET would have saved me a lot of time.
 
Jeremy
0 Kudos
Message 5 of 6
(3,016 Views)
Hey Jeremy,
    There's a good section of the LabVIEW Help dedicated to .NET.  It's under Fundamentals>>Windows Connectivity.  Other than that, there's a wealth of information in our Developer's Zone about .NET.  Here's a link to one article, but there are plenty more as well.


Brian B
Account Manager
National Instruments
0 Kudos
Message 6 of 6
(3,000 Views)