lundi 22 février 2016

Exchange sorting List C#

It jumps over if (newklädDataList[minst].märke.CompareTo(newklädDataList[j].märke) > 0), and i can't figure out why, can someone spot the problem?

public static void SortByMärke()
    {
        for (int i = 0; i < newklädDataList.Count; i++)
        {
            int minst = 1;
            for (int j = i + 1; j < newklädDataList.Count; j++)
            {
                if (newklädDataList[minst].märke.CompareTo(newklädDataList[j].märke) > 0)
                {
                    minst = j;
                }
            }
            if (i < minst)
            {
                Swap(minst, i);
            }
        }
    }

Aucun commentaire:

Enregistrer un commentaire