这是我第一次尝试使用属性,但我遇到了障碍,并且花了很多时间寻找示例。可能是因为我这样做完全错误。
我有一个设置所有属性的方法。
public class wsBase : Page
{
public class Client
{
public DateTime AppointmentDate{ get; set; }
public int TIN { get; set; }
public string Username { get; set; }
public string Password { get; set; }
}
public class Employee
{
public int SSN { get; set; }
}
public class Patient
{
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime DOB { get; set; }
public int Gender { get; set; }
}
}
设置功能:
public void SettingAppointmentData(int employeeID, DateTime ApptDt, DateTime patientDOB, string patientFname, string patientLname, int patientgender)
{
wsData wsD = new wsData();
Client cli = new Client();
Employee emp = new Employee();
Patient pat = new Patient();
pat.DOB = patientDOB;
patientFname = ValidateName(patientFname);
patientLname = ValidateName(patientLname);
pat.FirstName = patientFname;
pat.LastName = patientLname;
pat.Gender = patientgender;
}
我的问题在于尝试访问这些设置参数。下面是尝试访问参数的函数示例。下面不起作用,我知道我所看到的处理它是错误的。如何从这些属性访问属性集?
public bool eligibleAppointment()
{
wsBase.Client cli = new wsBase.Client();
wsBase.Employee emp = new wsBase.Employee();
wsBase.Patient pat = new wsBase.Patient();
DateTime DOB = pat.DOB;
DateTime appt = cli.AppointmentDate;
}