コード例 #1
0
 private bool CanConvertValue(Type sourceType, Type targetType)
 {
     return(ConversionUtils.CanConvertElements(
                ConversionUtils.GetDictionaryValueType(sourceType),
                ConversionUtils.GetDictionaryValueType(targetType),
                _conversionService));
 }
コード例 #2
0
        public override bool Matches(Type sourceType, Type targetType)
        {
            if (sourceType == typeof(string) && ConversionUtils.CanCreateCompatListFor(targetType))
            {
                return(ConversionUtils.CanConvertElements(sourceType, ConversionUtils.GetElementType(targetType), _conversionService));
            }

            return(false);
        }
コード例 #3
0
        public override bool Matches(Type sourceType, Type targetType)
        {
            if (!targetType.IsArray || sourceType.IsArray)
            {
                return(false);
            }

            return(ConversionUtils.CanConvertElements(
                       ConversionUtils.GetElementType(sourceType), ConversionUtils.GetElementType(targetType), _conversionService));
        }
コード例 #4
0
        public override bool Matches(Type sourceType, Type targetType)
        {
            // NO OP check Arrays already implement IList, etc.
            if (targetType.IsAssignableFrom(sourceType))
            {
                return(false);
            }

            if (sourceType.IsArray && ConversionUtils.CanCreateCompatListFor(targetType))
            {
                return(ConversionUtils.CanConvertElements(
                           ConversionUtils.GetElementType(sourceType), ConversionUtils.GetElementType(targetType), _conversionService));
            }

            return(false);
        }