このコード行に問題があります。
if(String.IsNullOrEmpty(m_nameList[index]))
私は何を間違えましたか?
編集:VisualStudioではm_nameListに赤い色で下線が引かれ、「名前'm_nameList'は現在のコンテキストに存在しません」と表示されますか?
編集2:コードを追加しました
class SeatManager
{
// Fields
private readonly int m_totNumOfSeats;
// Constructor
public SeatManager(int maxNumOfSeats)
{
m_totNumOfSeats = maxNumOfSeats;
// Create arrays for name and price
string[] m_nameList = new string[m_totNumOfSeats];
double[] m_priceList = new double[m_totNumOfSeats];
}
public int GetNumReserved()
{
int totalAmountReserved = 0;
for (int index = 0; index <= m_totNumOfSeats; index++)
{
if (String.IsNullOrEmpty(m_nameList[index]))
{
totalAmountReserved++;
}
}
return totalAmountReserved;
}
}
}