我将以一个例子来解释我的问题.我们在C#中有以下代码:
void A(Action block)
{
B(() =>
{
Console.WriteLine(2);
block();
});
}
void B(Action block)
{
Console.WriteLine(1);
block();
}
void Main()
{
A(() =>
{
Console.WriteLine(3);
});
}
1 2 3
现在,我想在PowerShell中编写这个代码:
function A($block) {
B {
2
. $block
}
}
function B($block) {
1
. $block
}
A {
3
}
The script Failed due to call depth
overflow. The call depth reached 1001
and the maximum is 1000.

