O'Reilly logo

C# 7 and .NET Core Cookbook by Dirk Strauss

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

  1. Expand the PurchaseOrderAnalyzer (Portable) project and open the DiagnosticAnalyzer.cs file.
  1. As seen earlier, you will see your diagnostic analyzer class. It should read public class PurchaseOrderAnalyzerAnalyzer : DiagnosticAnalyzer. Add the following code to the top of this class, replacing the code for the DiagnosticId, Title, MessageFormat, Description, Category, and Rule variables. Note that I have added two enumerators called ClassTypesToCheck and MandatoryInterfaces to the class. I only want this analyzer to act on a class if it is called PurchaseOrder or SalesOrder. I also only want the IReceiptable interface to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required