{
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
Object[] attributes = (Object[])type.GetCustomAttributes(false);
foreach (Object attribute in attributes)
{
//"LoggingFactoryImplementaionAttribute";
if (attribute.GetType().Name.ToLower().Equals(customAttributeName.ToLower()))
{
return (T)Activator.CreateInstance(type);
}
}
}
return default(T);
}

No comments:
Post a Comment