Explanation of Non-Primitive data type basics:
To store multiple data of same data type, we use Non-Primitive data type such as
Array, List, Hash-Set etc
Array are used to store the static data and canβt expand its memory size dynamically. Example:arrayNames = {"Name1", "Name2", "Name3", "Name1"}
List are used to store the data dynamically, it will expand its memory size and will allow duplicates.
To use the List we need to initialize the variable using New keyword listNames = New List(Of String) β Initialization
To add the static data to the list listNames = New List(Of String) FROM {"Name1", "Name2", "Name3", "Name1"}
To append the value to the existing list [add data dynamically]
β use Append Items to Collection activity and provide the values and list variable type
HashSet are used to store the data dynamically, it will expand its memory size and will not allow duplicates. It will work as same as List but will not allow duplicates.
Initialization of HashSet
β hashSetNames = New HashSet(Of String)
The best solution for the challenge is to store the names in List because we need to add the names dynamically at run time and the name may have duplicates too.
Solution:
Loop to collect multiple Name dynamically from user using Input Dialog Activity
Use Append Item to Collection activity to store the names in List variable
Convert List to String to Display all the name at once with code String.Join(Environment.NewLine, listNames) As String
Step1: Input collect through Input dialog
Step2: Store the name to List Note: If the list is not initialized, the the process will fail
Step3: Display the Names in one message using code String.Join(Environment.NewLine, listNames)