我能夠在一個控制檯應用程序使用HtmlAgilityPack,但在一個WPF應用程序嘗試時,我總是在這條線document.DocumentNode.Descendants()
此錯誤:HtmlAgilityPack不工作對我的WPF項目
Could not find an implementation of the query pattern for source type 'System.Collections.Generic.IEnumerable<HtmlAgilityPack.HtmlNode>'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
這是代碼:
public partial class Window1 : Window
{
public Window1()
{
var webget = new HtmlWeb();
var document = webget.Load("http://google.com");
var p = from program in document.DocumentNode.Descendants()
where program.Name == "a"
select program.InnerText;
InitializeComponent();
}
}
任何人都有一個idee爲什麼我得到那個錯誤?
謝謝。
但是你有一個在該源文件中使用System.Linq? – ordag
達姆,我很慚愧,請張貼它作爲答案,我會接受,謝謝。 – Kobe