示例#1
0
 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));
 }
示例#2
0
        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));
        }
示例#3
0
        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));
        }