Beispiel #1
0
        static string GenerateMarkdown(MetadataItem item, int level, MetadataItem parent = null)
        {
            var itemContent = item.Type switch
            {
                MemberType.Class => item.GenerateClassMarkdown(level),
                MemberType.Interface => item.GenerateClassMarkdown(level),
                MemberType.Struct => item.GenerateClassMarkdown(level),
                MemberType.Constructor => item.GenerateConstructorMarkdown(level),
                MemberType.Method => item.GenerateMethodMarkdown(level),
                MemberType.Property => item.GeneratePropertyMarkdown(level),
                MemberType.Enum => item.GenerateEnumMarkdown(level),
                MemberType.Field => item.GenerateFieldMarkdown(level, parent),
                MemberType.Namespace => MarkdownBase.Header(level, $"Namespace: {item.Name}{NewLine}"),
                MemberType.Assembly => MarkdownBase.Header(level, $"Assembly: {item.Name}{NewLine}"),
                _ => item + NewLine
            };

            var nestedContent = item.Items == null
                ? ""
                : string.Join(
                NewLine,
                item.Items.Select(x => GenerateMarkdown(x, level + 1, item))
                );

            return(itemContent + nestedContent);
        }
    }