【发布时间】:2013-12-12 21:39:32
【问题描述】:
我有一个收藏:IEnumerable<HtmlElement> propertyElements。
我想用foreach 循环枚举这个集合并查看其中包含的每个 HtmlElement。
到目前为止,我的代码如下所示:
private static void PrintObject(IEnumerable<HtmlElement> propertyElements)
{
Console.WriteLine("---------------------------------");
foreach (HtmlElement element in propertyElements)
{
Console.WriteLine(element.ToString());
}
Console.WriteLine("---------------------------------");
}
不过,我的输出如下所示:
System.Windows.Forms.HtmlElement
System.Windows.Forms.HtmlElement
System.Windows.Forms.HtmlElement
System.Windows.Forms.HtmlElement
System.Windows.Forms.HtmlElement
谁能指出我做错了什么?
【问题讨论】:
-
你想看html元素的哪一部分?
-
就像是 'div' 或 'img' 或其他 Html 元素。
标签: c# foreach ienumerable