Hello SO:
I have a subroutine that changes its operation slightly to include either one list or the other then perform the same operation. Since it is just counting the number of items in the list, I figure there is probably an easy way to get the item count regardless of the list type.
Thanks in advance!
EDIT:
private List<Message> currentMessages;
private List<Lead> currentLeads;
...
private void nextLeadBtn_Click(object sender, EventArgs e)
{
object temp;
if (includeAllCheck.Checked)
{
temp = currentMessages;
if (SelectedLead == (currentMessages.Count - 1))
SelectedLead = 0;
else
SelectedLead += 1;
}
else
{
temp = currentLeads;
if (SelectedLead == (currentLeads.Count - 1))
SelectedLead = 0;
else
SelectedLead += 1;
}
// This is what I want to replace the above with
//if (SelectedLead == ((List)temp).Count - 1) //obviously this does not work
// SelectedLead = 0;
//else
// SelectedLead += 1;
LoadPreviews(includeAllCheck.Checked);
}