Let's have a function:
Func<argsFoo, resultFoo> foo= x=>new resultFoo(x);
Func<argsBar, resultBar> bar= x=>new resultBar(x);
Func<argsBaz, resultBaz> baz= x=>new resultBaz(x);
I want to create a complex function which uses all this functions declared above.
Like this:
Func
<
Func<argsFoo, resultFoo>,
Func<argsBar, resultBar>,
Func<argsBaz,resultBaz>,
fooBarBazResult
> fooBarBaz=...
The point is such declaration is killing the readability of the programm. Type inference is not working in this case.
Question: can I use something like this?
FooBarBaz<typeof(foo),typeof(bar)>,typeof(baz)>>
I have tried and answer is no. May be anyone has another solution to make shorter the composed function declarations?
Funcis the return type. You have three Funcs with three different return types and still, you are trying to combine them with a Func that takes the first to of them as input and returns a Func that looks like the third? What are you really trying to do here?(x)=>{return new resultFoo(x);}(semicolon missing in your code!) can be simplified a bit, tox=>new resultFoo(x).