Re: Array.Sort(SortMethod As Delegate)

donJ <[email protected]> Mon, 6 Aug 2018 09:10:55 -0500
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
On 08/06/2018 04:39 AM, Jean-Luc Arnaud wrote:
> Hi all,
>
> I'd like to sort an array of FolderItems using a Sort Delegate method 
> based on their NativePath property.
>
> But the Language Reference says:
>
> "The delegate function must not mutate or examine at the contents of 
> the array while it is being sorted. Doing so will result in undefined 
> behavior."
>
> Is getting the NativePath of a FolderItem item in array considered as 
> examining the content of this array?
>
> Is so, how would you sort such an array on NativePath criteria?
>
> TIA
>
HI Jean-Luc,
If it doesn't work, couldn't you just build a second arry of paths and 
sort it using SortWith to sort the FolderItems? I sort custom classes 
this way all the time.

Don