Re: Array.Sort(SortMethod As Delegate)
Jean-Luc Arnaud <jean-luc-E/[email protected]> Mon, 6 Aug 2018 17:24:28 +0200
| Newsgroups | gmane.comp.lang.realbasic.user |
|---|---|
| Organization | Centre Direct du Multimédia |
| Message-ID | <[email protected]> |
Hi Don, Thanks for replying. I didn't test because of the "undefined behavior"!! And so, I hoped that someone would confirm it's not recommended to do this that way. Finally, after your reply, I tested it and it seems to work. Actually, I h'aven't seen "undefined behavior". Nevertheless, thank you very much for the advice, it would be very usefull if something goes wrong... Jean-Luc Arnaud Le 06/08/2018 à 16:10, donJ a écrit : > 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 >