Lớp này trông rất giống với các bộ phận của CompanyViewModel xử lý với địa chỉ. Trong thực tế, tôi đã sao chép và dán hầu hết các mã từ lớp đó vào AddressesViewModel. Nó là một lớp trừu tượng, vì vậy lớp CompanyViewModel thay đổi kế thừa từ | Chapter 4 Companies and Contacts get return public Delegatecommand DeleteAddressCommand get return endregion region Private Methods private void DeleteAddressCommandHandler object sender DelegateCommandEventArgs e MutableAddress address as MutableAddress if address null address endregion region Virtual Methods protected virtual void PopulateAddresses endregion This class should look very similar to the parts of the CompanyViewModel that dealt with Addresses. In fact I copied and pasted most of the code from that class into the AddressesViewModel. It is an abstract class so the CompanyViewModel class changed to inherit from AddressesViewModel instead of ViewModel. The only method that I needed to change was PopulateAddressses I had to change it to raise only the PropertyChanged event for the Addresses property and then I marked it as virtual so I could override it and call it from CompanyViewModel and ProjectContactViewModel . Here is the code for the ProjectContactViewModel using the new AddressesViewModel class using System using using using using using using continued 149 Chapter 4 Companies and Contacts continued using using using namespace public class ProjectContactViewModel AddressesViewModel region Constants private static class Constants public const string CurrentContactPropertyName CurrentContact endregion private Collectionview contacts private IList ProjectContact contactsList ProjectContact currentContact private CollectionView companies private DelegateCommand saveCommand private DelegateCommand newCommand region Constructors public ProjectContactViewModel this null public ProjectContactViewModel