LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
RBXSystems

Generic Class Support for .Net

Status: New

With LINQ (Language-Integrated Query) becoming increasing prevolant in .Net programming, more and more classes are using <T> Generics.

Unfortunately, LabVIEW does not support Generics, which limits the Methods and Classes available when importing .Net Dll's.

 

Take the following code:

 

namespace GenericsTest

{

   public class GenericList<T>

      {

      void Add(T input) { }

      }

 

   public class NonGenericList

      {

      void AddNoT() { }

      }

 

   class TestGenericList

      {

      private class ExampleClass { }

      static void Main()

            {

         // Declare a list of type int.

         GenericList<int> list1 = new GenericList<int>();

         // Declare a list of type string.

         GenericList<string> list2 = new GenericList<string>();

         // Declare a list of type ExampleClass.

         GenericList<ExampleClass> list3 = new GenericList<ExampleClass>();

            }

      }

}

 

When importing this to LabVIEW

 

GenClass.PNG

 

Notice that I can only see the "NonGenericList" Class as LabVIEW fails to destruct the "GenericList" Class.

One solution to this problem may to treat generics as Method/Constructor inputs, allowing the developed to choose the Generic Type.

6 Comments
Tesla1977
Member

Fantastic idea

RavensFan
Knight of NI

If you think it is a fantastic idea, then be sure to vote for it by clicking the Star icon to give it your kudo.  Just saying "Fantastic Idea" doesn't mean anything when NI looks at the vote counts in the Idea Exchange to determine which ideas have the most support.

 

 

NorbertJ
Member

Your proposal is a very good idea!

Furthermore LabVIEW has a problem when there are two methods with the same name and one of them is a Gerneric.
LabVIEW then offers the generic method, although it does not work. From my point of view this is not an extension but a bug.

RavensFan
Knight of NI

Again.   Norbert, Click the Kudo button if you want to vote for the idea!  If you read the idea, you should have read all the comments with that idea.  Just saying "very good idea" is not enough to register your vote.

 

Tesla1977
Member

Thanks RavensFan for your comment. I clicked the Kudo button now.

Smart_Li
Member

unfortunate, 8 years passed, nothing adopted