Inheritance: System.Attribute
Beispiel #1
0
        private Type SearchAssembly(Assembly assembly, string factoryId)
        {
            Tracer.DebugFormat("Searching Assembly: {0} for factory of the id: {1}",
                               assembly.GetName().Name, factoryId);

            Type[] types = assembly.GetTypes();

            foreach (Type type in types)
            {
                object[] attributes = type.GetCustomAttributes(false);
                foreach (Attribute attribute in attributes)
                {
                    if (attribute is AttributeType)
                    {
                        FactoryAttribute factoryAttribute = (FactoryAttribute)attribute;
                        if (factoryAttribute.FactoryIdentifier.Equals(factoryId))
                        {
                            Tracer.DebugFormat("Found the Factory of type {0} for id: {1}",
                                               type.ToString(), factoryId);
                            return(type);
                        }
                    }
                }
            }

            return(null);
        }