public void SetName(IEnumerable <BigInteger> prior, string firstName, string lastName) { var priorNames = Names.Where(n => prior.Contains(n.HashCodeInt)); if (priorNames.Count() == 1 && NameEquals(priorNames.Single(), firstName, lastName)) { return; } var newName = new MathematicianName(priorNames, firstName, lastName); if (Names.Any(n => n.HashCodeInt == newName.HashCodeInt)) { return; } Names.Add(newName); }
private bool NameEquals(MathematicianName prior, string firstName, string lastName) { return(prior.FirstName == firstName && prior.LastName == lastName); }