How to check the field variable of the object class?

I have a variable CurrentContentVM, the object class, which may happen to be placed an object of class WatchNoteVM (in which there is a property WatchNote). I need to perform the check:
if(CurrentContentVM is WatchNoteVM && CurrentContentVM.WatchNote == deleteNote)

Error:

Error CS1061 "object" does not contain a definition of "WatchNote" and failed to find an available extension method "WatchNote" that takes a type object as the first argument (possibly missing a using Directive or an Assembly reference)

How can I solve my problem?
April 3rd 20 at 17:39
1 answer
April 3rd 20 at 17:41
Solution
Try that

if(CurrentContentVM is WatchNoteVM wnVM && wnVM.WatchNote == deleteNote)

Find more questions by tags C#