0
我具有低於分配數據與列表類
public class G481Vars
{
public double Disp { get; set; }
public double IniVel { get; set; }
public double FinVel { get; set; }
public double Acc { get; set; }
public double Time { get; set; }
public double Force { get; set; }
public double Mass { get; set; }
public double Weight { get; set; }
public double Press { get; set; }
public double Dens { get; set; }
public double Energy { get; set; }
public double Area { get; set; }
public double Vol { get; set; }
}
類和我進行了列表作爲這樣:
List<G481Vars> G481List = new List<G481Vars>();
隨着定義爲
HtmlInputText[] G481Inputs = new HtmlInputText[13]
{
G481Disp_Txt, G481IniVel_Txt, G481FinVel_Txt, G481Acc_Txt,
G481Time_Txt, G481Force_Txt, G481Mass_Txt, G481Weight_Txt,
G481Press_Txt, G481Dens_Txt, G481Energy_Txt, G481Area_Txt,
G481Vol_Txt
};
的輸入框的陣列
如何去做這樣的事情
for (int i = 0; i < 13; i++)
{
if (G481Inputs[i].Value == "")
{
G481List[i] = 0;
}
else
{
//Other code here
}
}
要將0
分配給列表索引i
中的對象? 我得到的錯誤是「無法隱式轉換類型‘int
’爲....G481Vars
」
爲什麼你有一個'HtmlInputText'數組,你不能在這裏定義你的類嗎? – Sayse