You tring to access to modified cluser!!! In computer science, a closure is a first-class function with free variables that are bound in the lexical environment.
You can fix this code by this:
static void F(int n,Func<int>[] T)
{
if (n>0)
{
int tmp=m_k
P[m_k] = () => T[tmp]();
m_k++;
F(n-1,T);
}
else
{
P[m_k] = () => T[m_k]();
}
}
and by this:
for (int i = 0; i < 4; i++)
{
int j=i;
S[i] = () => T[j]();
}