Hi everybody,
i'm new to this forum and also to C#.
I hope someone with more experience can help me with my problem.
Given is the following Class
I have an Array of movie Objects, now i wanted to sort the Array by "ARCHIVE" which contains a string like "HDD 1" or "DVD - 145".
The sorting is quite good with this line of code:
But the Problem is that when all Movies have the same ARCHIVE-String (because they are all on the same Medium) the Names of the Movies will be totaly unsorted after sorting by ARCHIVE.
It looks like this:
Does anyone have a hint how to sort first by ARCHIVE and after that by NAME?
What i generally want is:
Thank you for reading my Post and hopefully you can help me with this.
greetings regalis
i'm new to this forum and also to C#.
I hope someone with more experience can help me with my problem.
Given is the following Class
Code:
public class movie
{
public long ID { get; set; }
public string NAME { get; set; } // 0
public string SIZE { get; set; } // 1
public string TYPE { get; set; } // 2
public DateTime CHANGEDATE { get; set; } // 3
public DateTime CREATIONDATE { get; set; } // 4
public DateTime LASTUSED { get; set; } // 5
public string ARCHIVE { get; set; }
public string PATH { get; set; }
public movie() { }
}
The sorting is quite good with this line of code:
Code:
Array.Sort(MovieArray, (x, y) => string.Compare(x.ARCHIVE, y.ARCHIVE, true));
It looks like this:
Code:
[B]Before sorting:[/B] ["Movie A", "HDD1"] ["Movie B", "HDD1"] ["Movie C", "HDD1"] ["Movie D", "HDD1"] ["Movie E", "HDD1"] [B]After Sorting:[/B] ["Movie D", "HDD1"] ["Movie E", "HDD1"] ["Movie A", "HDD1"] ["Movie B", "HDD1"] ["Movie C", "HDD1"]
What i generally want is:
Code:
["Movie A", "HDD1"] ["Movie B", "HDD1"] ["Movie C", "HDD1"] ["Movie D", "HDD1"] ["Movie E", "HDD1"] ["Movie A", "HDD2"] ["Movie B", "HDD2"] ["Movie C", "HDD2"] ["Movie D", "HDD2"] ["Movie E", "HDD2"] ["Movie A", "HDD4"] ["Movie B", "HDD4"] ["Movie C", "HDD4"] ["Movie D", "HDD4"] ["Movie E", "HDD4"]
greetings regalis
Comment