[Gambas-user] Sort an array of Objects[] of different Class

martin p cristia tercoide at hotmail.com
Tue Apr 21 22:25:57 CEST 2020


It is posible to use the .Sort() method to sort an array of differnt 
Class of Objects based on a variable or property?

dim myDifObj as New Object[]

dim thing1 as New Class1(4) ' The class saves that number for sorting

myDifObj.Add(thing1)

dim thing2 as New OtherClass(3) ' The class saves that number for sorting

myDifObj.Add(thing2)

dim thing3 as New anOtherClass(5) ' The class saves that number for sorting

myDifObj.Add(thing3)


myDifObj.Sort()  ???


I can't figure how to use special method _Compare( ???)  if it's even 
possible.

Thank you.



-- 
Saludos

Ing. Martin P Cristia



More information about the User mailing list