public virtual void WriteAssemblies(IEnumerable <IAssemblySymbol> assemblies, CancellationToken cancellationToken = default) { WriteStartAssemblies(); using (IEnumerator <IAssemblySymbol> en = assemblies .OrderBy(f => f.Name) .ThenBy(f => f.Identity.Version) .GetEnumerator()) { if (en.MoveNext()) { while (true) { cancellationToken.ThrowIfCancellationRequested(); IAssemblySymbol assembly = en.Current; WriteStartAssembly(assembly); WriteAssemblyDefinition(assembly); if (Format.GroupByAssembly) { if (Layout == SymbolDefinitionListLayout.TypeHierarchy) { WriteTypeHierarchy(assembly.GetTypes(Filter.IsMatch), cancellationToken); } else { WriteNamespaces(new OneOrMany <IAssemblySymbol>(assembly), cancellationToken); } } WriteEndAssembly(assembly); if (en.MoveNext()) { WriteAssemblySeparator(); } else { break; } } } } WriteEndAssemblies(); }