gpt4 book ai didi

C# - System.StackOverflowException 与 Lambda

转载 作者:太空狗 更新时间:2023-10-29 19:52:12 26 4
gpt4 key购买 nike

在什么情况下这段代码会出现 System.StackOverflowException 错误?

Accounts.Sort((x, y) => string.Compare(x.AccountId, y.AccountId));

更新:
该属性写为:

    public string AccountId
{
get { return _accountId; }
set { _accountId = value; }
}

没什么特别的。排序也不会被覆盖。

最佳答案

查看调用堆栈,您会看到哪个函数被一遍又一遍地执行。如果这是不可能的(例如,因为它在生产环境中运行),请提供更多信息。

关于被调用的属性调用了什么,这个函数在哪里被调用等

关于C# - System.StackOverflowException 与 Lambda,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2784344/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com