S
superjodash
Hi,
I am sorting a large List<FileInfo> using Sort(new MyComparable()). In
other areas, I'm using an anonymous delegate on a List<>.FindAll(...).
My question is this: How do you cancel out of these scenarios? For
instance, Sort calls the following
public class MyComparable() : IComparer<FileInfo> {
public virtual int Compare(FileInfo x, FileInfo y) {
// i want the cancel here
}
}
The problem is that the Sort method calls this function for each item.
Without throwing an exception, I can't seem to figure out how to stop
the sorting process. Granted, this is probably not a good idea since
it acts directly on the array. However, I still would like to know if
anyone knows how to do it.
Thanks,
John
I am sorting a large List<FileInfo> using Sort(new MyComparable()). In
other areas, I'm using an anonymous delegate on a List<>.FindAll(...).
My question is this: How do you cancel out of these scenarios? For
instance, Sort calls the following
public class MyComparable() : IComparer<FileInfo> {
public virtual int Compare(FileInfo x, FileInfo y) {
// i want the cancel here
}
}
The problem is that the Sort method calls this function for each item.
Without throwing an exception, I can't seem to figure out how to stop
the sorting process. Granted, this is probably not a good idea since
it acts directly on the array. However, I still would like to know if
anyone knows how to do it.
Thanks,
John