【发布时间】:2012-08-22 20:38:23
【问题描述】:
public class ModelInfo
{
public int AssignedCount { get; set; }
public int UnassignedCount { get; set; }
public int TotalCount { get { return UnassignedCount + TotalCount; } }
}
*编辑:* 当我将此代码放入 SO 时,我意识到 TotalCount 属性正在添加 UnassignedCount + TotalCount (我的意思是将其他两个计数加在一起)。有人可以详细解释为什么会发生 SO 错误吗?我的意思是,低级的东西。
堆栈溢出!
【问题讨论】:
-
你想知道为什么会发生堆栈溢出吗?无限递归就是答案。
TotalCount“调用”TotalCount“调用”TotalCount……你明白了。
标签: c# stack-overflow