我有一個用戶類,我想用它來創建用戶列表,直到用戶不再需要爲止。我不知道如何從控制檯獲取輸入。我已經刪除了我的主代碼,因爲它是一個混亂的混亂,並且寧願從頭開始。我的用戶類如下。通過用戶輸入將用戶添加到列表中C#
class Users
{
List<Users> _userList = new List<Users>();
private string _name;
private int _age;
private string _address;
private string _phone;
public Users(string name, int age, string address, string phone)
{
_name = name;
_age = age;
_address = address;
_phone = phone;
}
public string GetName()
{
return _name;
}
public void SetName(string name)
{
_name = name;
}
public int GetAge()
{
return _age;
}
public void SetAge(int age)
{
_age = age;
}
public string GetAddress()
{
return _address;
}
public void SetAddress(string address)
{
_address = address;
}
public string GetPhone()
{
return _phone;
}
public void SetPhone(string phone)
{
_phone = phone;
}
}
乾杯從用戶類
控制檯應用程序? –
什麼樣的用戶輸入?安慰 ?桌面 ? – kirotab
對不起,是的控制檯@saranshkataria – user5561715