I needed to get the anchor tags OuterHtml from HTML that I already had as text.
The following is how I used linq to get the outerhtml:
private void LinqHtmlDocument(string htmlText) { WebBrowser wb = new WebBrowser(); wb.Navigate(string.Empty); HtmlDocument hd = wb.Document; hd.Write(htmlText); var query = from HtmlElement he in hd.All where he.TagName == "A" && he.OuterHtml.Contains("SomeText") select new { OuterHtml = he.OuterHtml, }; } |