I'm new to C# coming from a python background. I've had a hard time figuring this out. In python I can use beautifulsoup to do this:
from bs4 import BeautifulSoup
r = requests.get('http://stackoverflow.com').content
soup = BeautifulSoup(r).prettify
This gets the source content of stackoverflow.com, and prints it in to the console.
I CANNOT figure out how to do this in C#.
var webGet = new HtmlWeb();
var document = webGet.Load("http://stackoverflow.com");
This does not work, it only prints the type of var document. Does anyone know how to do this? It would be much appreciated - I'm trying to learn C# by converting one of my python programs, just fyi.
OuterHtml property of the
var webGet = new HtmlWeb(); var document = webGet.Load("http://stackoverflow.com"); Console.WriteLine(document.DocumentNode.OuterHtml);