1 回答
TA贡献1780条经验 获得超4个赞
我认为您在这里遇到了一些命名问题。看这部分
public User(string Username, string Password, string Firstname, string MiddleInitial, string Lastname, string Suffix,
string address, string city, string state, string Zip, string Zip4, string Homephone, string Cellphone, string Workphone,
string NationalOrgn, string Country, string Company, string Section, string Department, string Usertype,
string Emailaddress)
{
this.mUsername = Username;
this.mPassword = Password;
this.mFirstname = Firstname;
this.mMiddleInitial = MiddleInitial;
this.mLastname = Lastname;
this.mSuffix = Suffix;
this.mAddress = Address;
this.mCity = City;
this.mState = State;
this.mZip = Zip;
this.mZip4 = Zip4;
this.mHomephone = Homephone;
this.mCellphone = Cellphone;
this.mWorkphone = Workphone;
this.mNationalOrgn = NationalOrgn;
this.mCountry = Country;
this.mCompany = Company;
this.mSection = Section;
this.mDepartment = Department;
this.mUsertype = Usertype;
this.mEmailaddress = Emailaddress;
}
特别是这个:
this.mAddress = Address;
this.mCity = City;
this.mState = State;
正确的方法是:
this.mAddress = address;
this.mCity = city;
this.mState = state;
你实际上没有使用你的参数(至少这三个)!这个“错误”有点意思,因为你的编译器没有抱怨。那是因为你实际上是在自己分配你的属性(=null),这是正确的,但肯定不是这里的意图;)!
将其更改为上面的应该可以解决问题。
- 1 回答
- 0 关注
- 117 浏览
添加回答
举报