public static bool CanConvert(this Type from, Type to)
        {
            if (from == null)
            {
                throw new ArgumentNullException(nameof(from));
            }

            if (to == null)
            {
                throw new ArgumentNullException(nameof(to));
            }

            return((from == to) ||
                   (to == typeof(object)) ||
                   (to == typeof(string)) ||
                   from.IsCastableTo(to) ||
                   (GenericNumberUtility.IsNumber(from) && GenericNumberUtility.IsNumber(to)) ||
                   (ConvertUtility.GetCastDelegate(from, to) != null));
        }
예제 #2
0
 public override bool CanValidateMember(MemberInfo member, Type memberValueType)
 {
     return(GenericNumberUtility.IsNumber(memberValueType));
 }
 public override bool CanDrawTypeFilter(Type type)
 {
     return(GenericNumberUtility.IsNumber(type));
 }