我无法计算 IRR。我使用 Microsoft.VisualBasic 来计算 IRR。这是一个案例:
using Microsoft.VisualBasic;
...
static void Main(string[] args)
{
double[] tmpCashflows = new double[] {
-480117.0,
4471.5158140594149,
6841.5950239895265,
6550.383550359461,
6295.8611873818609,
6074.6070899770129,
5883.532880960287,
6006.9907860976427,
6133.1633945923877
,6262.1156759885489
//,6393.9143799520116
};
decimal irr = 0;
try
{
double tmpIrr = Financial.IRR(ref tmpCashflows);
...
}
catch (Exception ex)
{
irr = 0;
}
}
它给出了“参数无效”类型的异常(在 Microsoft.VisualBasic.Financial.IRR(Double[]& ValueArray, Double Guess))。但是,如果我在 Excel 中进行计算,这不会显示任何错误。