public void RemoveSuffix(string text) { if (!Suffixes.Contains(text)) { return; } Suffixes.Remove(text); VisibleItems--; }
public void AddSuffix(string text, Color color) { if (Suffixes.Contains(text)) { throw new Exception($"Suffix with name '{text}' already exists!"); } Suffixes.Add(text, new Title(text, color)); VisibleItems++; }
/// <summary> /// Determines whether <see cref="piece"/> is a given name component as opposed to an affix, initial or title. /// </summary> /// <param name="piece">A single word from a name</param> /// <returns>False if <see cref="piece"/> is a prefix (de, abu, bin), suffix (jr, iv, cpa), title (mr, pope), or initial (x, e.); true otherwise</returns> private static bool IsRootname(string piece) { var lcPiece = piece.ToLower().Replace(".", string.Empty); return(!Suffixes.Contains(lcPiece) && !Prefixes.Contains(lcPiece) && !Titles.Contains(lcPiece) && !IsAnInitial(piece)); }
private static bool IsSuffix(string piece) { return(Suffixes.Contains(piece.Replace(".", string.Empty).ToLower()) && !IsAnInitial(piece)); }