To iterate through my result set, a lists of lists, I’m currently using:
foreach (IELog ieLog in emailAttach)
{
logAttachment += ieLog.FirstName + "," + ieLog.LastName +
"," + ieLog.Building + "," + ieLog.Room + "," + ieLog.Ingresstime + ","
+ ieLog.Egresstime + "\n";
}
I would like to compare ieLog.FirstName with the next one in line and image it would work something like this, just my syntax is wrong.
n = 0;
while (emailAttach.FirstName [n] == emailAttach.FirstName[n++] {
do something;
}
The result set looks like:
Person | Login | Logout
York Hunt intime outtime
York Hunt intime outtime
York Hunt intime outtime
York Hunt intime outtime
Mike Hunt intime outtime
Mike Hunt intime outtime
Mike Hunt intime outtime
Mike Hunt intime outtime
and I’m aiming for just the name once
York Hunt intime outtime
intime outtime
intime outtime
intime outtime
Mike Hunt intime outtime
intime outtime
intime outtime
intime outtime
Thank you for any help!
You’re trying to get the
FirstNameproperty of the nth item insideemailAttach.In other words,
emailAttach[n].FirstName.Also, you need to change
n++to++n.