public static IsFormatterType ( |
||
type | ||
Результат | bool |
public static bool IsFormatterType(Type type)
{
return type.IsSubclassOf(typeof(Formatter)) && type.GetCustomAttribute<FormatterAttribute>() != null;
}
public void RegisterFormatters(Assembly assembly) { var newMetaFormatters = assembly .GetTypes() .Where(type => MetaFormatter.IsFormatterType(type)) .Select(formatterType => new MetaFormatter(formatterType)); foreach (MetaFormatter newMetaFormatter in newMetaFormatters) { RegisterFormatter(newMetaFormatter); } }