[Mono-list] Minimum element of a list
theOptimizer
max.miran at gmail.com
Fri Jan 7 18:49:48 EST 2011
Jonathan Pryor is right you cannot access indexes from the enumerator. I
would use a normal loop for this. I posted a silly example using a
enumerator.
<code>
List<double> d;
int i = 0;
using (System.Collections.Generic.List<double>.Enumerator enumerator
d.GetEnumerator())
{
while (enumerator.MoveNext())
{
double min_e = min_element(i))
i++;
}
}
double min_element (int i)
{
using (System.Collections.Generic.List<double>.Enumerator enumerator
d.GetEnumerator())
{
while (i > 0)
{
enumerator.MoveNext();
i--;
while (enumerator.MoveNext())
{
if ()
{
notFound = false;
d = enumerator.Current;
}
}
while (enumerator.MoveNext())
{
checkMin(i, enumerator.Current))
i++;
}
}
}
<code>
--
View this message in context: http://mono.1490590.n4.nabble.com/Minimum-element-of-a-list-tp3200185p3204542.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list