In c# you can hide the type of the in parameter to a generic method.
Is it be possible to do the same when you have a in type and a generic method?
Code for visualization of what I am trying to achieve:
public class A { ... }
public class B { ... }
private Task BaseMethod<T>(T request) {
...
}
private Task<R> BaseMethod<T, R>(T request) {
...
}
public Task foo(A request) => BaseMethod(request);
// The following line works
public Task<B> bar(A request) => BaseMethod<A, B>(request);
// But I wanted something like the next line
public Task<B> bar(A request) => BaseMethod(request);
Thanks for your time.
CodePudding user response:
No, this is not currently a thing that is supported in the language.