MPIon
Well-known member
I am new to this forum and not sure if this is the right place for this post, but I am having a problem with Array.Sort
I have a class
and an array set to this class :-
I now want to sort this class and following examples on the internet I have used :-
This works, but I want to restrict to sorting only some of the elements, so tried
This gives two compilation errors:
of ICompare routine, but none of the examples I found had a reference to one element of the Class.
I'm sure there must be a simple solution, without reinventing the wheel.
I have a class
C#:
public class FileList
{
public string path;
public bool isFolder;
}
C#:
public static FileList[] fileList = new FileList[1000];
for (int i = 0; i < 1000; i++)
fileList = new FileList();
I now want to sort this class and following examples on the internet I have used :-
C#:
Array.Sort(fileList, (x, y) => string.Compare(x.path, y.path));
C#:
Array.Sort(fileList, 0, 10, (x, y) => string.Compare(x.path, y.path));
andArgument 2, cannot convert from int to system array
Can't comprehend what this means or find any help on the internet that might explain what is going wrong here. I think I may need to write some sortCannot convert lambda expression to type int because it is not a delegate type.
of ICompare routine, but none of the examples I found had a reference to one element of the Class.
I'm sure there must be a simple solution, without reinventing the wheel.
Last edited by a moderator: