How to add elements to tuple

Hii please Help ASAP,

I have a list of names of type string : list_name=“Joe”,“Meow”,“Barbie”, “Jolly”
and list of Roll numbers of type integer : list_RollNo=1,2,3,4

I need to add these names and Roll number to tuple.
If i need joe then its roll number should be 1

Please Help How to add these name and roll number to tuples

Let s focus at first to: How to store elements, by creating a tuple

we can create:
grafik
grafik

When it is about adding, then maybe a list of Tuple(Of Int32, String) will better serve as we can add new tuples to the list
grafik

But the Tuple struct has no add method

We would recommend to check the business case and check if other datatypes / datastructures will better serve

When the names should be represented by a number:

  • array and item position
  • dictionary( of int32, String)
    are maybe a better choice

Coming back to the strength of tuples: When different datatypes are to handle / kept and we do look for a datatype safe approach then tuples are helping much.

But as mentioned above we maybe can better handle the case with alternates

Feel free to tell us more about your business case

Also have a look here:

in other .Net editions and newer versions other functionalities were introduced

Hi @Doonline, I hope you are doing well.
To answer your question if you want a key value which is here roll number and map it with a value which is names here. According to me you can make use of dictionary rather than tuples in UIPath as it will be more convenient. For dictionaries I will attach a sample workflow which might help you.

Please let me know if dictionary will be more convenient for you or you still want to use tuples.
Dictionary_Sample with KeyValuePair.xaml (6.3 KB)

Thanks & Regards,
Shubham Dutta

I cant use dict as i dont have unique key

Hi @Doonline
Roll numbers will be unique only right? Just wanted clarification.

Thanks & Regards,
Shubham Dutta