In our codebase we have a lot of code like
if (Some.Property != someValue)
{
Some.Property = someValue;
}
Some.Property:
- comes from third party libraries and cant be changed
- has expensive setter
I want to refactor this to be more clear. In C++ i'd be able to write a macros UpdateIfChanged.
Is there way to do this besides writing extensions for Some class, e.g. with generics?