截图:
功能:把等号两边内容互换,减轻赋值编码负担。例如:
// 基本信息
this.textBox_name.Text = _patient.PatienName;
this.textBox_age.Text = _patient.PatientAge.ToString();
this.comboBox_sex.SelectedIndex = _patient.PatientSex;
this.textBox_tel.Text = _patient.ContactPhone;
this.textBox_contact.Text = _patient.ContactName;
//门诊信息
this.textBox_no.Text = _patient.MenZhenNo;
this.comboBox_bloodType.SelectedItem = _patient.BloodType;
this.textBox_history.Text = _patient.History;
//住院信息
this.dateTimePicker_intime.Value = _patient.InTime;
this.textBox_inNo.Text = _patient.InNo;
this.textBox_bedNo.Text = _patient.BedNo;
转换成:
// 基本信息
_patient.PatienName = this.textBox_name.Text;
_patient.PatientAge = int.Parse(this.textBox_age.Text);
_patient.PatientSex = this.comboBox_sex.SelectedIndex;
_patient.ContactPhone = this.textBox_tel.Text;
_patient.ContactName = this.textBox_contact.Text;
//门诊信息
_patient.MenZhenNo = this.textBox_no.Text;
_patient.BloodType = this.comboBox_bloodType.SelectedItem.ToString();
_patient.History = this.textBox_history.Text;
//住院信息
_patient.InTime = this.dateTimePicker_intime.Value;
_patient.InNo = this.textBox_inNo.Text;
_patient.BedNo = this.textBox_bedNo.Text;