/// <summary>
        /// Visits a <see cref="CodeNamespaceImportCollection"/>.
        /// </summary>
        /// <param name="codeNamespaceImportCollection">The <see cref="CodeNamespaceImportCollection"/> to visit.</param>
        protected override void VisitCodeNamespaceImportCollection(CodeNamespaceImportCollection codeNamespaceImportCollection)
        {
            CodeNamespaceImport[] sortedImports = codeNamespaceImportCollection.Cast <CodeNamespaceImport>().OrderBy(i => i.Namespace, new NamespaceImportComparer()).Distinct().ToArray();

            codeNamespaceImportCollection.Clear();
            codeNamespaceImportCollection.AddRange(sortedImports);

            base.VisitCodeNamespaceImportCollection(codeNamespaceImportCollection);
        }
Пример #2
0
        public void Constructor0_Deny_Unrestricted()
        {
            CodeNamespaceImportCollection coll = new CodeNamespaceImportCollection();

            coll.Add(cni);
            Assert.AreSame(cni, coll[0], "this[int]");
            coll[0] = cni;
            coll.Clear();
            coll.AddRange(array);
            Assert.IsNotNull(coll.GetEnumerator(), "GetEnumerator");
        }