Is it OK to have virtual async method on base class?

后端 未结 3 1010
北荒
北荒 2021-02-04 23:29

I am working with some code, where I have 2 classes with very similar logic and code. I have protected async void LoadDataAsync() method on both classes.
Curren

3条回答
  •  攒了一身酷
    2021-02-05 00:29

    Agree with @Sam.
    I throw exception just to ensure that actual logic is implemented. Better fits my requirement, that's all.

    protected virtual Task LoadDataAsync()
    {
        throw new NotImplementedException();
    }
    

提交回复
热议问题