c# - Need help print list of strings -
i trying print innertext values class xyz, printed "system.collections.generic.list`1[system.string]
public list<string> getl1names() { uitestcontrol document = browinx.currentdocumentwindow; htmlcontrol control = new htmlcontrol(document); control.searchproperties.add(htmlcontrol.propertynames.class, "xyz"); uitestcontrolcollection controlcollection = control.findmatchingcontrols(); list<string> names = new list<string>(); foreach (htmlcontrol link in controlcollection) { if (link htmlhyperlink) names.add(control.innertext); } return names; }
using print
console.writeline(sitehome.getl1names());
"system.collections.generic.list`1[system.string]
that because system.collections.generic.list<t>
not overload tostring(). default implementation (inherited system.object) prints name of object's type, seeing.
you mean iterate through of elements in list, , print each separately.
you can change
console.writeline(sitehome.getl1names());
to like
foreach (var name in sitehome.getl1names()) { console.writeline(name); }
Comments
Post a Comment