嘿,我目前正在为大学编写程序,创建类时我正在使用get set方法。我的问题是,有没有比下面所示的方法更简单的设置方式。
代码片段展示了我目前的方式:
private string customer_first_name;
private string customer_surname;
private string customer_address;
public DateTime arrival_time;
//Using accessors to get the private variables
//Using accessors to set the private variables
public string Customer_First_Name
{
get { return customer_first_name; }
set { customer_first_name = value; }
}