下面是我创建的类,用于跟踪我荣耀的数据录入和检索应用中的当前Person。一旦他们选择一个人,它会调用constrtuctor,然后调用数据库来填充所有其他信息。而且,在整个计划中,他们将能够改变各个领域。正确使用对象属性
考虑到这一点,我有下面的设置正确吗?我对属性和使用对象存储跨多种形式的数据exprrenced,并会感谢任何见解。
谢谢!
class CurrentPerson
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string MiddleName { get; set; }
public string SuffixID { get; set; }
public string TitleID { get; set; }
public string SocialSn { get; set; }
public string BirthDate { get; set; }
public string Gender { get; set; }
public string DlNumber { get; set; }
public string DlStateID { get; set; }
public string PrimaryRace { get; set; }
public string SecondaryRace { get; set; }
public string EmailAddress { get; set; }
public string MaritalStatus { get; set; }
public string InsertProgram { get; set; }
public string InsertUserID { get; set; }
public string UpdateProgram { get; set; }
public string UpdateUserID { get; set; }
public string LockID { get; set; }
public int PersonID { get; set; }
public int ClientID { get; set; }
public int ResidencyCountyID { get; set; }
public int ResponsibilityCountyID { get; set; }
public bool HispanicOriginFlag { get; set; }
public bool CitizenFlag { get; set; }
public bool VeteranFlag { get; set; }
public DateTime DeathDate { get; set; }
public DateTime InsertDateTime { get; set; }
public DateTime UpdateDateTime { get; set; }
// Put the default Constructor back in
public CurrentPerson(){}
// Custom Constructor that needs the PersonID
public CurrentPerson(int pID)
{
PersonID = pID;
// Methods to get rest of data here
}
}
如果我有私人设置,我仍然可以从我的表单设置变量? – 2009-04-20 15:55:27
你仍然可以在你的表单上使用这个变量,你不能指定它 - 你的代码将不能编译。 – 2009-04-20 15:56:41
通过一个构造函数,将是唯一的方法来设置它是否是私有的?谢谢! – 2009-04-20 15:58:06