我正在寻找一个代码来检查我的double数组的元素是否为空.我试着用isNaN,string.isNullOrEmpty并0.0D但没有做,我仍然有这样的文字:不是一个数字.
那么,你知道C#中的任何代码能够检查double数组中的元素是否为空?
这是我的代码:
if (!Double.IsNaN(d1.getChiffreAffaireBase()[keyIndex1]))
{
textBox43.Text = calcMargeCa(d1.getChiffreAffaireBase()[keyIndex1], d1.getChiffreAffairePlus()[keyIndex1]).ToString("0.00");
textBox44.Text = calcMargeCa(d1.getChiffreAffaireBase()[keyIndex1+1], d1.getChiffreAffairePlus()[keyIndex1+1]).ToString("0.00");
}
else
{
label13.Hide();
textBox43.Hide();
textBox44.Hide();
}
Run Code Online (Sandbox Code Playgroud)