0
public string getContent(string webAddress)
    {
        HtmlAgilityPack.HtmlWeb web = new HtmlAgilityPack.HtmlWeb();
        HtmlDocument doc = web.Load(webAddress);
        return string.Join(" ", doc.DocumentNode.Descendants().Select(x => x.InnerText));
    }

Am using this function trying to check what does the function do! But am getting the exception which tells me the function Decendants does not exist in the current context! Though i have included the refrenced dll of agility pack!

2
Contributors
5
Replies
6
Views
4 Years
Discussion Span
Last Post by Momerath
0

trying to use it in a console based c# application! included the dll of agility pack from HtmlAgilityPack.1.4.6 package's Net45 folder's dll!

1

This is the code I'm using, and no issues

using System;
using System.Linq;
using HtmlAgilityPack;

namespace Testing {
    class Program {
        static void Main(string[] args) {
            HtmlWeb web = new HtmlWeb();
            HtmlDocument doc = web.Load("http://www.google.com");
            Console.WriteLine(string.Join(" ", doc.DocumentNode.Descendants().Select(x => x.InnerText)));
            Console.ReadLine();

         }
    }
}

I also added the reference by using the "manage nuget" option when you right click references.

Edited by Momerath

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.