Search code examples
c#xamarinmvvmcrossfodyfody-propertychanged

Is it safe to use Fody.PropertyChanged with MVVMCross Or it is down the performance of app?


Today I read about new plugin on net which Fody.PropertyChanged which is very simple and easy to use.

Currently I am using MVVMCross where we have to call RaisePropertyChange(()=>Property) again and again. Is it safe to use Fody.PropertyChanged with MVVMCross. Any One have experience of that I also watch this example of using MVVMCross and Foody.RaisePropertyChange

https://github.com/slodge/BindingTalk/blob/master/BindingTalk.Droid/ViewModels/FodySimpleViewModel.cs

Or Is there any solution in MVVMCross from which we get rid from using RaisPropertyChange() again and again

Thanks,

Best Regard


Solution

  • Fody.PropertyChanged should not be any slower than manual calls to RaisePropertyChanged. What Fody.PropertyChanged effectively does is write that code for you at compile time.

    So, you don't have to type all those messy RaisePropertyChanged calls, and you don't have to see them either, making your code much cleaner. But if you look at what gets compiled (using ILSpy or a similar program), you will see that they've all been automatically added for you. So, from a performance standpoint, there should be no difference, but it makes your code easier to write, easier to read, and easier to maintain.

    I'm a huge fan of Fody.PropertyChanged. I've been using it for years now with MVVM Light (which I believe is similar MVVMCross), and I've never found it to be the cause of a slowdown. I definitely suggest you give it a try.

    If you are using version control (which you should be), commit your project, install Fody.PropertyChanged, get rid of all those RaisePropertyChanged calls, and watch the magic happen. If you don't like it, you can always go back to your previous version.