例如我有这段代码
var person = new HighrisePerson()
{
FirstName = firstName,
ContactData = new HighriseContactData()
{
EmailAddresses = new List<HighriseEmailAddress>
{
new HighriseEmailAddress
{
Address = email,
Location = "Work"
}
}
}
};
我想重构一下:
var person = new HighrisePerson(firstName, email)
我希望这个构造函数添加到我的HighrisePerson Class
public HighrisePerson(string firstName, string email)
{
FirstName = firstName,
ContactData = new HighriseContactData()
{
EmailAddresses = new List<HighriseEmailAddress>
{
new HighriseEmailAddress
{
Address = email,
Location = "Work"
}
}
}
};