Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NamespaceDetector"/> class.
        /// </summary>
        /// <param name="typeDeclarations">The type declarations to investigate.</param>
        public NamespaceDetector(CodeTypeDeclarationCollection typeDeclarations)
        {
            Guard.NotNull(() => typeDeclarations, typeDeclarations);
            this.typeDeclarations = typeDeclarations;

            // storedDeclarations = typeDeclarations.OfType<CodeTypeDeclaration>().ToList();
            this.storedDeclarations = typeDeclarations.OfType<CodeTypeDeclaration>().ToArray();

            IEnumerable<string> distinctNamespaces;
            this.ShortestNamespace = DetermineShortestNamespace(this.storedDeclarations, out distinctNamespaces);
            this.namespaces = distinctNamespaces.ToArray();
        }