Please correct me if I am wrong but I could not find anything straight forward like this online. Assuming you have the following:
static Func<int,int> GetInt(int n)
{
return (int y) =>
{
if (y < 2)
return (y);
return
GetInt(n - 1)(y) - GetInt(n - 2)(y);
};
}
Trying to get the result by calling this anonymous function is returning something like System.Func`2[System.Int32,System.Int32]. How can you achieve recursion using anonymous functions. How could I cast the return value which is the actual function in order to get the result?