i was writing the following
if(this.tabControl1.TabPages.Count != ImagesList.Count())
{
foreach (var item in this.tabControl1.TabPages)
{
}
}
and i couldn't access the controls inside each item using item. But with a defining it's type like
if(this.tabControl1.TabPages.Count != ImagesList.Count())
{
foreach (TabPage item in this.tabControl1.TabPages)
{
}
}
i could easily access them using item.Controls
so i was wondering why do i really need to define/cast those items as TabPage
, shouldn't the compiler/intellasense figure it out as each item inside this.tabControl1.TabPages
is actually a TabPage
?