How to do it...

  1. Start Visual Studio, navigate to File | New | Project..., create a new C# class library project, and replace the code in Class1.cs with code from the code sample at ClassLibrary/Class1.cs.
  2. Click on Tools | Options to bring up the tools options dialog and navigate to the C# code style options (Text Editor | C# | Code Style | General):
  1. Change the Severity of 'this.' preferences to Suggestion, predefined type preferences to Warning, and 'var' preferences to Error. Change the Preference of 'var' preferences from Prefer explicit type to Prefer 'var':
  1. Change the Severity of Code block preferences to Warning and change the ...

Get Roslyn 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.