I'm trying to sort my list using an algorithm. The list contains string arrays which holds date, titel and entry.
So the error message I am getting is this:
Error CS0019 Operator '>' cannot be applied to operands of type 'string[]' and 'string[]'
I will not include all of my code, as it is not in English anyway.
List<string[]> loggBok = new List<string[]>();
void nyttInlägg(string datum, string titel, string text) // När användaren anropar denna metoden från menyn, så kommer hans input
// läggas in i vektorn.
{
string[] anteckingar = new string[3] { "", "", "" };
anteckingar[0] = datum;
anteckingar[1] = titel;
anteckingar[2] = text;
loggBok.Add(anteckingar);
bool isSorted = false;
while (!isSorted)
{
isSorted = true;
for (int i = 0; i < loggBok.Count - 1; i++)
{
if ((loggBok[i]) > loggBok[i + 1])
{
string[] temp = loggBok[i + 1];
loggBok[i + 1] = loggBok[i];
loggBok[i] = temp;
}
i = i + 2;
}
}
So basically, every 3 element in the list will hold a stringarray with a date. This is the date that I want to organize. I believe I understand the logic behind the algorithm but I just cannot get the syntax right. I have checked other threads, some with similar problems but none that was 100%. As this is a school project it has to be an algorithm, thus I don't want to make it "easier" or more effective in anyway. Any ideas on how to overcome this horrible error message?
if ((loggBok[i]) > loggBok[i + 1])withif ((loggBok[i][0]) > loggBok[i + 1][0]))(also a closing parenthesis). That will compare the dates.