How it works...

The example in this recipe does not even begin to scratch the surface of what is possible with code analyzers. A great way to learn what is possible is to have a look at some of the code analyzers on GitHub. View the code and start writing your own code analyzers. As with most concepts in programming, the only way to learn this is to write the code. There is a wealth of information available on the Internet. A word of advice, though: before you start writing your code analyzers, take a look to see if there isn't an analyzer that already does what you need (or is close to doing what you need).

For example, if you need to ensure method comments include additional information, try to find an analyzer that already does something ...

Get C# 7 and .NET Core 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.