Firing an event / function on a property? (C#)

后端 未结 8 1454
你的背包
你的背包 2021-02-08 11:46

I am using a class that I cannot edit, it has a property (a boolean) of which it would be nice to be informed when it changes, I can\'t edit the properties get or set as I am im

8条回答
  •  时光说笑
    2021-02-08 12:42

    You can try to inherit it and use it's child instead of it. Override the "set" of the property so it raises the event.

    EDIT: ... only if property is virtual in the parent class ...

提交回复
热议问题