the "override" of default interface impl of AcceptChanges does not call the default interface impl after casting this to interface type containing the default interface implementation. Why?
public interface IItemViewModel1
{
void AcceptChanges() => Debug.Print("In interface");
}
public class ItemViewModelBase1<TModel> : IItemViewModel1
where TModel : new()
{
private TModel _data;
public void AcceptChanges()
{
Debug.Print("In ViewModel");
_data ??= new TModel();
((IItemViewModel1)this).AcceptChanges(); // calling itself rather than default interface implementation
}
}
public static class TestClass
{
public static void Test()
{
IItemViewModel1 x = new ItemViewModelBase1<int>();
x.AcceptChanges();
}
}