Malcolm Groves from Embarcadero has a new unit posted on Github called Generics.Tuples and it implements generic tuple support in Delphi XE5, Delphi XE6 and AppMethod. It should also work cross platform on Android, IOS, Windows, and OSX. Tuples are a single type that can hold multiple other types. Malcolm used the generics capability of Object Pascal to implement two and three parameter tuples. A sample usage for a tuple that he gives is being able to return two values from a function instead of just one. It currently supports tuples containing two and three items. I checked out the Microsoft docs for the C# tuples object and the Microsoft one supports up to 8. You can easily add more than the 3 it currently has to this Object Pascal implementation if you need more. Here is his sample code for using a tuple to store two different values:
LTuple : ITuple<Integer, String>;
LTuple := TTuple<Integer, String>.Create(10, 'Hello');
x := LTuple.Value1 + 10;
Add Generic Tuple Support With Generics.Tuples In Firemonkey On Android And IOS by Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Tokyo Firemonkey, Delphi Android, Delphi IOS is licensed under a Creative Commons Attribution 4.0 International License.