Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to store user input into list c#

List<string> ItemList = new List<string>();
Console.WriteLine("Items Added To Inventory Are: "); // Outputs List in reverse order. (Recent input first).
for (int i = 0; i < 10; i++) // Continue For Loop until i is < the needed amount.
{
    Console.WriteLine($"{i+1}: Enter Item Name To Add To Inventory"); // Asks for user input into array.
    var ListInput = Console.ReadLine(); // User inputs value into field.
    ItemList.Add(ListInput);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# how to exit program 
Csharp :: solution to fizzbuzz c# 
Csharp :: unity put children in list 
Csharp :: blazor alert 
Csharp :: how to remove last 3 characters from string in c# 
Csharp :: how create another new app file in laravel 
Csharp :: object to mouse unity 
Csharp :: get length of enum values 
Csharp :: unity vscode launch.json 
Csharp :: best practice c# check if string is null or whitespace 
Csharp :: convert int to uint c# 
Csharp :: how to get the path of the current directory in c# 
Csharp :: how to check the distance between two dates c# 
Csharp :: how to make an object jump in unity 
Csharp :: c# check if array is empty 
Csharp :: public GameObject 
Csharp :: unity 2d joystick controls 
Csharp :: small modal popup bootstrap 
Csharp :: how to get the position of a camera in unity 
Csharp :: c# stop loop 
Csharp :: c# palidrone 
Csharp :: c# generate random number 
Csharp :: unity animator check if animation is playing 
Csharp :: c# difference between two dates in milliseconds C# 
Csharp :: how to change color of a sprite in unity 
Csharp :: how to set up blender with unity units 
Csharp :: get random color 32 
Csharp :: c# console foreground color 
Csharp :: increase timeout in .net core web app 
Csharp :: instantiate list c# 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =