public static bool NameMatches <TFrom, TTo>(TFrom from, TTo to) where TFrom : Thing where TTo : Thing { return(string.Equals(from.ComparisonName, to.ComparisonName, OrdinalIgnoreCase) && Types.AreInSomeSenseCompatible(from.Type, to.Type)); }
public static bool WithoutPrefix <TFrom, TTo>(TFrom from, TTo to, string removablePrefix) where TFrom : Thing where TTo : Thing { if (!from.ComparisonName.StartsWith(removablePrefix, OrdinalIgnoreCase)) { return(false); } return(string.Equals(from.ComparisonName.Substring(removablePrefix.Length), to.ComparisonName, OrdinalIgnoreCase) && Types.AreInSomeSenseCompatible(from.Type, to.Type)); }
public static bool WithoutId <TFrom, TTo>(TFrom from, TTo to) where TFrom : Thing where TTo : Thing { if (!from.ComparisonName.EndsWith("ID", OrdinalIgnoreCase)) { return(false); } return(string.Equals(from.ComparisonName.Substring(0, from.ComparisonName.Length - 2), to.ComparisonName, OrdinalIgnoreCase) && Types.AreInSomeSenseCompatible(from.Type, to.Type)); }