# Pattern Matching ## Property Matching ```csharp if (document is BaseView { BoxElement: MeasurementFolder } view) { RmDocumentView.Controller?.Activate(view); } ``` Introduced in C# 8. See https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8#more-patterns-in-more-places. ## Null Pattern Matching Older C# versions allowed to check for null using the `is` operator. This is misleading as `is` checks for two things (if an object is null and if its type matches). With pattern matching you can check if the value is null like: ```csharp if (maybeNull is { }) { //... } ```