@senglory , you could try the following code to implment the generic method from the abstract class without the compliler errors.
public abstract class BaseStorage
{
public abstract Response<T> GetDemo<T,K>(Request<K> request);
}
public class ChildStorage : BaseStorage
{
public override Response<T> GetDemo<T, K>(Request<K> request)
{
return new Response<T>();
}
}
You could call it like the following code:
Request<int> request = new Request<int>();
request.Id = 1;
Response<MyDto> response = new Response<MyDto>();
response.Data = new MyDto { Name="test1" ,Description="d1"};
ChildStorage storage = new ChildStorage();
Response<MyDto> response1 = storage.GetDemo<MyDto, int>(request);
Hope this could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.