Exemple #1
0
        public bool IsAssignableTo(ITypeDescriptor from, ITypeDescriptor to)
        {
            if (to == null ||
                from.FullName == to.FullName ||
                from.IsTypeOf("System", "Int32") && to.IsTypeOf("System", "Boolean"))
            {
                return(true);
            }

            if (from.IsValueType != to.IsValueType)
            {
                return(false);
            }

            var typeHierarchy = GetTypeHierarchy(from);

            return(typeHierarchy.Any(x => x.FullName == to.FullName));
        }
Exemple #2
0
 public bool IsIntegralType(ITypeDescriptor type)
 {
     return(_integralTypes.Any(x => type.IsTypeOf(x.Namespace, x.Name)));
 }