I’m learning MVVM in a course from Brian Lagunas in PluralSight.
At the beginning, he was writting this two interfaces:
public interface IView
{
IViewModel ViewModel {get;set;}
}
public interface IViewModel
{
IView View {get;set;}
}
I was learning in that mode, and then he removed ViewModel from IView.
public interface IView {}
But I can’t see the difference of it, perhaps there’s advantages and disadvantages of it.
Is anything wrong if I put the first example?
This is of course to less context to leave any useful statements, but at first sight the interface
seems very confusing for me because the main idea of the MVVM pattern is that the ViewModel is totally unaware of the View. If you equip the ViewModel with a reference to the View your are violating this idea.