Open Neutrino-Sunset opened 3 years ago
The method isn't a lambda, it is a expression-bodied method. The body itself is a lambda. I am used to working with the =>
operator pervasively. I think I'd split this into two lines, but that's all I'd change. Just my opinion.
public IHttpProxyBuilder WithEndpoint(string endpoint) =>
this.WithEndpoint((context, args) => new ValueTask<string>(endpoint));
or, in C#9:
public IHttpProxyBuilder WithEndpoint(string endpoint) =>
this.WithEndpoint((_, _) => new ValueTask<string>(endpoint));
This is just painful to look at.
A method implemented as a lambda, multiple lambdas at that, one implementation delegating to something that reads almost like an overload (WithEndpoint -> WithEndpoints). All on a single line. This kind of thing is programmer trolling.