Boo.Lang.Compiler.TypeSystem.Reflection.ReflectionNamespace.Add C# (CSharp) Méthode

Add() public méthode

public Add ( Type type ) : void
type System.Type
Résultat void
        public void Add(Type type)
        {
            string typeName = TypeUtilities.TypeName(type);
            TypeListFor(typeName).Add(type);
            if (IsModule(type))
                AddModule(type);
        }

Usage Example

        private void CatalogPublicTypes(IEnumerable <Type> types)
        {
            string lastNs = "!!not a namespace!!";
            ReflectionNamespace lastNsEntity = null;

            foreach (Type type in types)
            {
#if DNXCORE50
                if (!type.GetTypeInfo().IsPublic)
                {
                    continue;
                }
#else
                if (!type.IsPublic)
                {
                    continue;
                }
#endif

                string ns = type.Namespace ?? string.Empty;
                //retrieve the namespace only if we don't have it handy already
                //usually we'll have it since GetExportedTypes() seems to export
                //types in a sorted fashion.
                if (ns != lastNs)
                {
                    lastNs       = ns;
                    lastNsEntity = GetNamespace(ns);
                    lastNsEntity.Add(type);
                }
                else
                {
                    lastNsEntity.Add(type);
                }
            }
        }