Server.TypeTable.Add C# (CSharp) Méthode

Add() public méthode

public Add ( string key, Type type ) : void
key string
type System.Type
Résultat void
		public void Add( string key, Type type )
		{
			m_Sensitive[key] = type;
			m_Insensitive[key] = type;
		}

Usage Example

        public Library(Config.Library libConfig, Assembly _assembly)
        {
            name = libConfig.Name;
            assembly = _assembly;

            ArrayList typeList = new ArrayList();
            assembly.GetTypes();
            foreach (Type type in assembly.GetTypes()) {
                if (libConfig == null || !libConfig.GetIgnoreType(type))
                    typeList.Add(type);
            }
            types = (Type[])typeList.ToArray(typeof(Type));

            typesByName = new TypeTable(types.Length);
            typesByFullName = new TypeTable(types.Length);

            Type typeofTypeAliasAttribute = typeof(TypeAliasAttribute);

            foreach (Type type in types) {
                typesByName.Add(type.Name, type);
                typesByFullName.Add(type.FullName, type);

                if (type.IsDefined(typeofTypeAliasAttribute, false)) {
                    object[] attrs = type.GetCustomAttributes(typeofTypeAliasAttribute, false);

                    if (attrs != null && attrs.Length > 0 && attrs[0] != null) {
                        TypeAliasAttribute attr = attrs[0] as TypeAliasAttribute;
                        foreach (string alias in attr.Aliases)
                            typesByFullName.Add(alias, type);
                    }
                }
            }

            typeCache = new TypeCache(types, typesByName, typesByFullName);
        }
All Usage Examples Of Server.TypeTable::Add