我正在查找代碼來檢查我的double數組的元素是否爲空。我試着用isNaN
,string.isNullOrEmpty
和0.0D
但沒有什麼可做的,我仍然有這樣的文字:不是數字。檢查雙c的空元素數組#
那麼,你知道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();
}
你是什麼意思* empty *? 'double'是一個ValueType,它不能是「空的」。 –
發佈您的代碼,然後我們會更好地瞭解您要做什麼。 – Nasreddine
我有double [] array = new double [12],我想檢查例如array [6]是否沒有值。 –