public class Program
{
public static List<Players> DB = new List<Players>();
static void Main(string[] args)
{
Console.WriteLine("Please choose action: ");
Console.WriteLine("Type 'Register', 'Deposit', 'Withdraw' or 'Info' to continue.");
}
static void Register()
{
Players Player = new Players();
Console.WriteLine();
Console.WriteLine("Register New Player");
Console.WriteLine();
Console.WriteLine("Please Type Username:");
string username = Console.ReadLine();
Player.username = username;
Console.WriteLine();
Console.WriteLine("Please Type Fisrt Name:");
string firstname = Console.ReadLine();
Player.firstname = firstname;
Console.WriteLine();
Console.WriteLine("Please Type Last Name:");
string lastname = Console.ReadLine();
Player.lastname = lastname;
Console.WriteLine();
Console.WriteLine("Please Type Birth Date:");
string birthdate = Console.ReadLine();
Player.birthdate = birthdate;
DB.Add(Player);
}
}
所以我问我怎样才能显示存储在数据库列表中的项目?或者我做错了什么?
答案 0 :(得分:0)
可能类似
Foreach(Player p in DB) { Console.WriteLine(p.firstname); }