Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

didSet detection on ANY field?

I've done some searching (and mostly finished C# in depth) but haven't come across what I'm looking for.

I'm curious though if there is a way (hacky is ok!) that I can get a generic notification or hook from ANY set operation on a class.

The reason is I am working on a framework that saves the state of the app as a class. And when the state changes, I want a notification from it.

Setting up a didSet (i.e. firing an alert in every setter call) on every possible field is tedious overkill. Do you know of any way I can get hook for any time a field is changed on a class?

Update 1

A great suggestion by @thehennyy was to look at PostSharp. Here is a video which highlights what it does: https://vimeo.com/143656221

Update 2

Open source MIST suggested by @Mattias Åslund.

like image 280
Aggressor Avatar asked Dec 11 '25 06:12

Aggressor


1 Answers

Take a look at MIST on github. It will do exactly what you are looking for and is free.

like image 184
Mattias Åslund Avatar answered Dec 12 '25 19:12

Mattias Åslund



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!