private static MethodInfo DetermineToMethod(Type targetClass, Type sourceClass) { if (typeof(string) == targetClass || typeof(string) == sourceClass) { // Do not accept a ToString() method or any to methods on String itself return(null); } var method = ConversionUtils.GetMethodIfAvailable(sourceClass, "To" + targetClass.Name); return(method != null && !method.IsStatic && targetClass.IsAssignableFrom(method.ReturnType) ? method : null); }