1 回答

TA貢獻1780條經(jīng)驗 獲得超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;
你實際上沒有使用你的參數(shù)(至少這三個)!這個“錯誤”有點意思,因為你的編譯器沒有抱怨。那是因為你實際上是在自己分配你的屬性(=null),這是正確的,但肯定不是這里的意圖;)!
將其更改為上面的應(yīng)該可以解決問題。
- 1 回答
- 0 關(guān)注
- 158 瀏覽
添加回答
舉報