예제 #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));
        }
예제 #2
0
 public bool IsIntegralType(ITypeDescriptor type)
 {
     return(_integralTypes.Any(x => type.IsTypeOf(x.Namespace, x.Name)));
 }