C# を使用して、データ テーブルのすべての行の各セルにアクセスしたいと考えています。それを行うためのベストプラクティスは何ですか?
for (int i = 0; i <= 5; i++)
{
if (myQuantity[i]!=null && myQuantity[i].Length>0)
{
row = dt.NewRow();
row["Name"] = myName[i];
row["Quantity"] = myQuantity[i];
row["Price"] = myPrice[i];
c = Convert.ToInt32(myQuantity[i]);
int price = Convert.ToInt32(myPrice[i]) * c;
row["Amount"] = price;
dt.Rows.Add(row);
}
}