idisposable

This commit is contained in:
Tommy Parnell
2016-12-02 13:15:54 -05:00
parent 322f417a54
commit 26a6d447e0

View File

@@ -63,13 +63,15 @@ namespace alexa.dev.excuses
throw new Exception("Something really wrong with the rando generator");
}
// Asynchronously get the document in a new context using the configuration
var document = await BrowsingContext.New(config).OpenAsync(address);
// This CSS selector gets the desired content
var cellSelector = "a";
// Perform the query to get all cells with the content
var cells = document.QuerySelectorAll(cellSelector);
// We are only interested in the text - select it with LINQ
return cells.First().TextContent;
using (var document = await BrowsingContext.New(config).OpenAsync(address))
{
// This CSS selector gets the desired content
var cellSelector = "a";
// Perform the query to get all cells with the content
var cells = document.QuerySelectorAll(cellSelector);
// We are only interested in the text - select it with LINQ
return cells.First().TextContent;
}
}
}
}