Invalid substitution type 'Entity.Product' supplied

Posted by sderrico on 03-Mar-2014 08:09

Hello,

I am trying to declare a list of a custom class. I wrote this code:

USING Progress.Lang.*. /* OK */
USING System.Collections.ObjectModel.*. /* OK */
USING "System.Collections.Generic.List<System.Windows.Forms.Button>". /* OK */
USING "System.Collections.Generic.List<CHARACTER>". /* OK */
USING "System.Collections.Generic.List<Entity.Product>". /* ERROR */

I am facing this error message on compilation:

Invalid substitution type 'Entity.Product' supplied for a type parameter of Generic class List<Entity.Product>. (15214)

My class look like this:

USING Progress.Lang.*.

CLASS Entity.Product INHERITS System.Object:

END CLASS.

I am able to create a variable like this:

DEFINE VARIABLE oItem AS CLASS "Entity.Product" EXTENT 20 NO-UNDO.

Can someone point me out why the class System.Windows.Forms.Button is compiling but not the Entity.Product class for a List<T>?

Thank you!
Sebastien


Posted by Mike Fechner on 03-Mar-2014 11:31

You cannot define a .NET Generic type with an ABL Class as the member type.

If your ABL class inherits from a .NET Type you can add instances of the ABL class to a Generic type with the original .NET type as the member type.

If your ABL class inherits from System.Object and implements a .NET Interface you can add instances of the ABL class to a Generic type with the .NET Interface as the member type. In that case you need to make the .NET Interface available via an Assembly.

All Replies

Posted by sderrico on 03-Mar-2014 08:50

I found the following text in the documentation. Is that mean that we cannot create List of ABL Class?


An open type reference contains only placeholders for the parameters in the type name, such as <T>, which defines the single parameter for the following generic type: System.Collections.Generic.List<T>

In ABL, you can only reference a .NET generic type as a constructed type.

Reference: documentation.progress.com/.../index.jsp

Posted by Mike Fechner on 03-Mar-2014 11:31

You cannot define a .NET Generic type with an ABL Class as the member type.

If your ABL class inherits from a .NET Type you can add instances of the ABL class to a Generic type with the original .NET type as the member type.

If your ABL class inherits from System.Object and implements a .NET Interface you can add instances of the ABL class to a Generic type with the .NET Interface as the member type. In that case you need to make the .NET Interface available via an Assembly.

Posted by Brian K. Maher on 03-Mar-2014 12:08

This is a test.

This thread is closed