Although the other answers already cover what you should be doing i.e. using a List (code taken from this answer):
var games = new List<Tuple<string, Nullable<double>>>()
{
new Tuple<string, Nullable<double>>("Fallout 3: $", 13.95),
new Tuple<string, Nullable<double>>("GTA V: $", 45.95),
new Tuple<string, Nullable<double>>("Rocket League: $", 19.95)
};
And then you can call the Add method:
games.Add(new Tuple<string, double?>("Skyrim: $", 15.10));
I'd like to point out a few things you can do to improve your code.
The string in the Tuple should just be the game name, you can always format it later:
string formattedGame = $"{game.Item1}: ${game.Item2}";
There doesn't seem to be much need for using Nullable<double> (can also be written as double? BTW), consider just using a double.
- When dealing with monetary values it is advisable to use
decimal, so consider switching to that.
- Consider using a custom class i.e.
Game. This will simplify the code and help later on when you want to add more details i.e. Description, Genre, AgeRating etc.
For more detail on when to use an array or a list see this question, however, the short version is you should probably be using a list.