User Tools

Site Tools


codesamples:sorting_collection_delegate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
codesamples:sorting_collection_delegate [2021/10/20 09:53] – created wolfgangriedmanncodesamples:sorting_collection_delegate [2026/03/18 12:58] (current) wolfgangriedmann
Line 15: Line 15:
  
 oPersons:Sort( ; oPersons:Sort( ;
-  delegate( o1 Person, o2 as Person ) {+  delegate( o1 as Person, o2 as Person ) {
     local nResult as int     local nResult as int
     nResult := o1:Name:CompareTo( o2:Name )     nResult := o1:Name:CompareTo( o2:Name )
Line 21: Line 21:
     } ;     } ;
   )</code>   )</code>
 +  
 +Attention: this code currently compiles only in Core dialect, not in VO dialect.
 +But there is a shorter form that compiles also in VO dialect:
 +
 +<code>oPersons:Sort( {o1 AS Person, o2 AS Person => 
 + LOCAL nResult AS INT
 + nResult := o1:Name:CompareTo(o2:Name)
 + RETURN nResult
 + })</code>
codesamples/sorting_collection_delegate.1634723607.txt.gz · Last modified: 2021/10/20 09:53 by wolfgangriedmann