Sto utilizzando htmlAgilityPack
per recuperare i dati da una tabella in quanto
var text = from x in htmlDoc.DocumentNode.Descendants()
where x.Name == "p" && x.Attributes.Contains("class")
where x.Attributes["class"].Value == "cut"
select x.InnerText;
Durante il debug posso accedere alla Results View
che mostra tutti i dati analizzati a cui ho bisogno di accedere. Tuttavia non riesco a capire come return
l'array di dati che è stato analizzato.
Come posso fare questo?
Quello che si sta restituendo è una semplice stringa indietro al testo variabile, quindi non c'è nulla per iterare o visualizzare i risultati (ResultsView). Ricordarsi che non si restituisce un oggetto IEnumerable per utilizzare ResultViews.
Penso che tu abbia bisogno di questo
var Result= from x in htmlDoc.DocumentNode.Descendants()
where x.Name == "p" && x.Attributes.Contains("class")
where x.Attributes["class"].Value == "cut"
foreach(var Item in Result){
//Access Item here.
}
Se, non in grado di return
è solo il tuo problema, credo che sia abbastanza semplice ..
var text=from x in htmlDoc.DocumentNode.Descendants()
where x.Name == "p" && x.Attributes.Contains("class")
where x.Attributes["class"].Value == "cut"
select x.InnerText;
//As the above query returns string,so you can check the result here..
Label1.text=text.ToString()