コード例 #1
0
        private string ComposeListPage(HttpContext context, IDiagnosticInfo info)
        {
            var builder = new StringBuilder();

            foreach (var group in info.ListAll()
                     .GroupBy(entry => entry.Component, StringComparer.OrdinalIgnoreCase)
                     .OrderBy(group => group.Key))
            {
                builder.AppendLine($"<h2>{group.Key}</h2>");
                builder.AppendLine("<ul>");

                foreach (var entry in group.OrderBy(entry => entry.Name, StringComparer.OrdinalIgnoreCase))
                {
                    builder.AppendLine($"<li><a href=\"{CreateInfoUrl(entry)}\">{entry.Name}</a></li>");
                }

                builder.AppendLine("</ul>");
                builder.AppendLine("<br/>");
            }

            return(builder.ToString());
        }