So I have a list(panelList) that I created and I inserted 10 Panel controls (which are already created on the aspx design page).. However, when I try and check if panelList[0] is the same panel as Panel1(which is the first panel I added in panelList), I get returned FALSE... any idea why? Here is my code
static List<Panel> panelList = new List<Panel>();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
panelList.Add(Panel1);
panelList.Add(Panel2);
panelList.Add(Panel3);
panelList.Add(Panel4);
panelList.Add(Panel5);
panelList.Add(Panel6);
panelList.Add(Panel7);
panelList.Add(Panel8);
panelList.Add(Panel9);
panelList.Add(Panel10);
}
}
protected void AddQuestionButton_Click(object sender, EventArgs e)
{
Debug.WriteLine(panelList[0].Equals(Panel1));
// here i get returned false in the debug output
}