我在类中定义了两个Double类型变量,如下所示
public Double IgnoreCommission { get; set; }
public Double IncludeCommissionAndDiv { get; set; }
我已经在我的代码库中使用了这些变量到很多位置,其中包含大而复杂的计算。不幸的是,我已经开始遇到计算返回NaN或Infinity的情况。而且我无法指出它失败的地方。因此,不是痛苦地调试所有的计算(我在过去3-4小时内正在进行),我怎样才能在getter属性中处理它?
答案 0 :(得分:2)
如果您自己添加支持字段并且设置条件断点来检查您要检查的内容,则应该很容易。然后只需检查callstack :
private Double ignoreCommission;
private Double includeCommissionAndDiv;
public Double IgnoreCommission
{
get
{
return this.ignoreCommission; <-- set conditional breakpoint here
}
set
{
this.ignoreCommission = value; <-- set conditional breakpoint here
}
}
public Double IncludeCommissionAndDiv
{
get
{
return this.includeCommissionAndDiv; <-- set conditional breakpoint here
}
set
{
this.includeCommissionAndDiv = value; <-- set conditional breakpoint here
}
}