public ITypeConverter GetTypeConverter(Type type) { var converter = fallback.GetTypeConverter(type); if (converter == null) { var typeConverterAttribute = type.GetTypeInfo().GetCustomAttribute<TypeConverterAttribute>(); if (typeConverterAttribute == null) { return null; } var qualifiedName = typeConverterAttribute.ConverterTypeName; var converterType = Type.GetType(qualifiedName, true); var converterInstance = (TypeConverter) Activator.CreateInstance(converterType); converter = new ConverterAdapter(converterInstance); } return converter; }
public ITypeConverter GetTypeConverter(Type type) { var converter = fallback.GetTypeConverter(type); if (converter == null) { var typeConverterAttribute = type.GetTypeInfo().GetCustomAttribute <TypeConverterAttribute>(); if (typeConverterAttribute == null) { return(null); } var qualifiedName = typeConverterAttribute.ConverterTypeName; var converterType = Type.GetType(qualifiedName, true); var converterInstance = (TypeConverter)Activator.CreateInstance(converterType); converter = new ConverterAdapter(converterInstance); } return(converter); }