RTC Forums
November 23, 2024, 02:41:20 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Passing a Tlist object to an RTC function. Possible ?  (Read 5033 times)
mastinfo
RTC License
***
Posts: 29


« on: July 05, 2018, 11:13:30 AM »

Hello,

i'm wondering if is possible to have as parameter for and RTC function a Tlist object (system.Generics.collections) and how.

The class is defined as follow:

   Tmyrec=record
     field1:string;
     field2:string;
     something else ....
   end;

   Tmyrecords=class(TList<Tmyrec>)
   end;


thanks in advance

Roberto
Logged
mastinfo
RTC License
***
Posts: 29


« Reply #1 on: July 05, 2018, 11:47:32 AM »

Maybe i have found the solution by myself: i can use an array where each element is a record

Let me know if there's another solution that allow to pass directly the Tlist as parameter.

thanks

Roberto
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #2 on: July 05, 2018, 12:09:19 PM »

You've found the correct solution.

When you have a list of elements without names, you can use an Array ("asArray" = "TRtcArray" class). And if you have a collection of elements where each element has a name, you can use a Record ("asRecord" = "TRtcRecord" class). Since every single element can be of any data type supported by RTC Value Objects (String, Integer, Data, Record, Array, ...), you can create any structure you can think of simply by combining these data types.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 17 queries.