Closed negue closed 9 years ago
Ill experiment with this shortly.
My only concern is the use of reflection which is relatively expensive and may cause some cross platform issues (most notably IOS and Webplayer). That said, it is cleaner if it works.
This has been added. Also I was wrong about the reflection. This method is faster for some reason. I have included a second example scene which demonstrates this.
Correction : the removal of the second equity check (line 37) makes the new method (Set) significantly slower. (.07:4.0)
Hm I see,
maybe then a Set-Method without the Stacktraces, then we'd have to write the current Property down BUT we dont have to check, set and raise propertychanged event for each property, which should be still fast enough
The current way to handle viewmodel properties is like this:
it works sure, but I dont like that style, I'm kinda used to the
CallerMemberNameAttribute
and MVVMLight Set-Method.Too bad this attribute doesn't exist...
Anyway what do you think of this example code:
Set-Method in Unity