It seemed that the C # compiler would simply refuse to infer the type recursively. Take this sample code, for example:
(From @Eric: That's right, type inference requires that all โinputโ lambda types are known before the lambda output type is output)
public void Run()
{
var k = Generator((str, parent) => new {
Name = str,
Parent = parent
});
}
public Func<string, T, T> Generator<T>(Func<string, T, T> generator)
{
return (str, obj) => generator(str, obj);
}
, <T> Generator<T>... , , .