📌  相关文章
📜  如何将用户输入存储到列表c#代码示例中

📅  最后修改于: 2022-03-11 14:48:55.831000             🧑  作者: Mango

代码示例1
List ItemList = new List();
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);
}