Hi. I'm struggling to figure out how multiple options can be chosen from an array in C#. I have provided some code of the array that I have created (see below).
string[] AddionalExtras = new[] { "1 - 16” Alloys", "2 - Privacy Glass", "3 - Spare Wheel", "4 - Parking Pack", "5 - SYNC 3 with Navigation", "6 - Winter Pack", "7 - Floor mats", "8 - Boot liner", "9 - Dashboard camera", "10 - Pet travel mat" }; // Any additional extras will be displayed in the array
Console.WriteLine(String.Join(Environment.NewLine, AddionalExtras)); // All of the extras are displayed from the array, line by line
Console.WriteLine("Please select any of the extras that you would like to purchase!");
int ExtraSelection = Convert.ToInt32(Console.ReadLine()); // Integer called 'ExtraSelection' created and will be set based on the users input
What I would like is for when at this section in my console application, the user should be allowed to pick more than one item, if they wish to, and then have that selection output back to them (I should have no problem coding that part). Is there an efficient and easy way to do this?
Within my application, most, if not all of my other arrays are also strings, but only require one option, so this is new to me. I am still relatively new to the language, so apologies if there are glaring errors, or an obvious way around this (I did try searching for a solution, but couldn't find anything).
I hope this is enough code to help answer my question.
Thanks