Exemple #1
0
        public bool Matches(Type type, ConverterLibrary converter)
        {
            if (type.IsArray && converter.CanBeParsed(type.GetElementType()))
            {
                return(true);
            }


            return(type.IsGenericEnumerable() && converter.CanBeParsed(type.GetGenericArguments()[0]));
        }
Exemple #2
0
 public bool Matches(Type type, ConverterLibrary converter)
 {
     try
     {
         return(TypeDescriptor.GetConverter(type).CanConvertFrom(typeof(string)));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #3
0
        public bool Matches(Type type, ConverterLibrary converter)
        {
            if (type.IsArray)
            {
                return(false);
            }

            var constructorInfo = type.GetConstructor(new[] { typeof(string) });

            return(constructorInfo != null);
        }
Exemple #4
0
 public abstract bool Matches(Type type, ConverterLibrary converter);
 public bool Matches(Type type, ConverterLibrary converter)
 {
     return(type.IsEnum);
 }
 private ObjectConverter(Func <Type, object> finder, ConverterLibrary library)
 {
     _library = library;
     _finder  = finder;
 }
 public ObjectConverter(IServiceLocator services, ConverterLibrary library)
     : this(type => services.GetInstance(type), library)
 {
 }
 public bool Matches(Type type, ConverterLibrary converter)
 {
     return(type.IsNullable());
 }