Can you explain to me why in this piece of code:
private Dictionary<Type, Type> viewTypeMap = new Dictionary<Type, Type>();
public void ShowView<TView>(ViewModelBase viewModel, bool showDialog = false)
where TView : IView
{
var view = Activator.CreateInstance(viewTypeMap[typeof(TView)]);
(IView)view.ShowDialog();
}
I get an error message:
"Only the destination, call, increment, decrement and new expression object can be used as an operator."
IView defines the ShowDialog () method.
source
share