private static DocumentedType CoallateTypeWithDocumentation(INamedTypeSymbol type) { var fields = ImmutableArray.CreateBuilder <DocumentedSymbol <IFieldSymbol> >(); var methods = ImmutableArray.CreateBuilder <DocumentedSymbol <IMethodSymbol> >(); var properties = ImmutableArray.CreateBuilder <DocumentedSymbol <IPropertySymbol> >(); var events = ImmutableArray.CreateBuilder <DocumentedSymbol <IEventSymbol> >(); foreach (var member in type.GetMembers()) { var xml = DocumentationComment.Parse(member.GetDocumentationCommentXml()); switch (member) { case IFieldSymbol field: fields.Add(new DocumentedSymbol <IFieldSymbol>(field, xml)); break; case IMethodSymbol method: methods.Add(new DocumentedSymbol <IMethodSymbol>(method, xml)); break; case IPropertySymbol prop: properties.Add(new DocumentedSymbol <IPropertySymbol>(prop, xml)); break; case IEventSymbol @event: events.Add(new DocumentedSymbol <IEventSymbol>(@event, xml)); break; } } return(new DocumentedType(type, DocumentationComment.Parse(type.GetDocumentationCommentXml())) { Fields = fields.ToImmutable(), Methods = methods.ToImmutable(), Properties = properties.ToImmutable(), Events = events.ToImmutable() }); }