How it works...

In steps 1 to 12, we added a blank solution and then we added a .NET Standard 2.0 class library to the solution. In these steps, we assigned proper names to the solution and the project. In steps 13 and 14, we renamed the default class template to something more meaningful. You can also delete this class and create a new one.

In step 15, we added two namespaces to the code. In step 16, we created a class-level variable and created an instance of the HttpClient class. In step 17, we created an asynchronous public method that reads the given site content as a string and returns the read content.

Finally, we performed a quick build to check the syntax.

Get .NET Standard 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.