public static List <StringTransformationAttribute> LoadAllTransformationClasses() { Assembly assembly = Assembly.GetExecutingAssembly(); IEnumerable <Type> typesImplementingAttribute = GetTypesWithStringTransformationAttribute(assembly); List <StringTransformationAttribute> attributeList = new List <StringTransformationAttribute>(); foreach (Type type in typesImplementingAttribute) { StringTransformationAttribute attribute = (StringTransformationAttribute)type.GetCustomAttribute(typeof(StringTransformationAttribute)); attributeList.Add(attribute); } return(attributeList); }
public static Dictionary <StringTransformationType, Type> LoadAllTransformationTypes() { Assembly assembly = Assembly.GetExecutingAssembly(); IEnumerable <Type> typesImplementingAttribute = GetTypesWithStringTransformationAttribute(assembly); Dictionary <StringTransformationType, Type> stringTransformationMapping = new Dictionary <StringTransformationType, Type>(); foreach (Type type in typesImplementingAttribute) { StringTransformationAttribute attribute = (StringTransformationAttribute)type.GetCustomAttribute(typeof(StringTransformationAttribute)); stringTransformationMapping.Add(attribute.TransformationType, type); } return(stringTransformationMapping); }