C
Ching-Lung
Hi,
The code:
class Row
{
public int m_Id;
public string m_Name;
public Row(int id, string name)
{
m_Id = id;
m_Name = name;
}
}
class Table
{
public ArrayList m_Table;
public Table()
{
Row row1 = new Row(5, "hello");
Row row2 = new Row(10, "world");
m_Table = new ArrayList(2);
m_Table.Add(row);
m_Table.Add(row2);
}
public int GetId(int rowNumber)
{
return m_Table[rowNumber].???
}
public string GetName(int rowNumber)
{
return m_Table[rowNumber].???
}
}
If I call Table.GetId(0), it should return 5. If I call
Table.GetName(1), it should return "world".
So, how do I access the public members of class Row from
the ArrayList in class Table?
Please help. Thanks!
-CL
The code:
class Row
{
public int m_Id;
public string m_Name;
public Row(int id, string name)
{
m_Id = id;
m_Name = name;
}
}
class Table
{
public ArrayList m_Table;
public Table()
{
Row row1 = new Row(5, "hello");
Row row2 = new Row(10, "world");
m_Table = new ArrayList(2);
m_Table.Add(row);
m_Table.Add(row2);
}
public int GetId(int rowNumber)
{
return m_Table[rowNumber].???
}
public string GetName(int rowNumber)
{
return m_Table[rowNumber].???
}
}
If I call Table.GetId(0), it should return 5. If I call
Table.GetName(1), it should return "world".
So, how do I access the public members of class Row from
the ArrayList in class Table?
Please help. Thanks!
-CL