【发布时间】:2016-01-05 02:11:01
【问题描述】:
我需要将自定义类的通用列表的内容转换为 html。例如,如果我将以下类的值存储在通用列表中:
public class PlatypusSummary
{
public String PlatypusName { get; set; }
public int TotalOccurrencesOfSummaryItems { get; set; }
public int TotalSummaryExceptions { get; set; }
public double TotalPercentageOfSummaryExceptions { get; set; }
}
...所以我最终得到一个像这样的通用列表:
List<PlatypusSummary> _PlatypusSummaryList = null;
. . .
var dbp = new PlatypusSummary
{
PlatypusName = summary["duckbillname"].ToString(),
TotalOccurrencesOfSummaryItems = totalOccurrences,
TotalSummaryExceptions = totalExceptions,
TotalPercentageOfSummaryExceptions = totalPercentage
};
_PlatypusSummaryList.Add(dbp);
...如何将该通用列表的内容转换为 HTML?
【问题讨论】:
-
虽然我看到您试图提供问题和答案来帮助他人,但您的问题本身过于宽泛,因此不适合 Stack Overflow。
-
不出所料,我不同意;该解决方案很容易适应任何通用列表。
-
您的问题应该能够站得住脚。它不能,因为它太宽泛了。想一想可以做到这一点的所有方法——有几十种方法可以从一些对象列表生成 HTML。有人合法地问你刚才问了什么,我会认为过于宽泛,并告诉他们研究他们的选择,选择一个,实施它,然后如果他们在实施过程中遇到困难,才来 Stack Overflow。
标签: c# html dom generic-list