How it works...

In steps 1 to 11, we created a blank solution and added a .NET Standard 2.0 library to the solution. In these steps, we assigned proper names to the solution and to the library. In steps 12 and 13, we renamed the existing Class1.cs created by Visual Studio. In step 15, we created a using directive to access the file operations.

In step 16, we created two private variables to hold the filename and the StreamWriter class. In step 17, we created the default constructor and we are calling the WriteLog() method we created in step 18. In step 19, we created three test methods to demonstrate logging. Finally, in step 20, we performed a quick build to check for 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.