private static string FormatSection(ReportSection s) { var list = new List <string> { GetElementName(s) + ":" }; foreach (var e in s.GetItems()) { list.Add("- " + e.ToString()); } return(string.Join("\r\n", list)); }
private static string GetElementName(ReportSection s) { var type = s.GetItemType(); return(type.GetCustomAttributes(typeof(DisplayNameAttribute), false).SingleOrDefault() is DisplayNameAttribute attribute && !string.IsNullOrEmpty(attribute.DisplayName) ? attribute.DisplayName : type.Name); }
private static bool SectionHasElements(ReportSection s) { return(s != null && s.GetItems().Count() > 0); }