- Expand the PurchaseOrderAnalyzer (Portable) project and open the DiagnosticAnalyzer.cs file.
- 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 ...
Get C# 7 and .NET Core Cookbook now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.