// and so on public Property(string address, RealEstateAgent realEstateAgent) { if (string.IsNullOrWhiteSpace(address)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(address)); } Address = address; RealEstateAgent = realEstateAgent ?? throw new ArgumentNullException(nameof(realEstateAgent)); }
public override bool Equals(object another) { if (another == null) { return(false); } if (another.GetType() != GetType()) { return(false); } RealEstateAgent anotherAgent = (RealEstateAgent)another; return(Id == anotherAgent.Id && Name == anotherAgent.Name); }