[Mono-list] Minimum element of a list

theOptimizer max.miran at gmail.com
Fri Jan 7 18:51:11 EST 2011


opps that was a mess up

static void Main(string[] args)
{
    List<double> d = new List<double>(); 
    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)
{
    double min;
    using (System.Collections.Generic.List<double>.Enumerator enumerator2 =
d.GetEnumerator())
    {
        while (i > 0)
        {
            enumerator2.MoveNext();
            i--;
        }

        min = enumerator2.Current;

        while (enumerator2.MoveNext())
        {
            if (min > enumerator2.Current)    
   	        {
                min = enumerator2.Current;
            }
        }

    }

    return min;
}

-- 
View this message in context: http://mono.1490590.n4.nabble.com/Minimum-element-of-a-list-tp3200185p3204544.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list