Logo

Programming-Idioms

History of Idiom 28 > diff from v77 to v78

Edit summary for version 78 by zqwnvl:
New VB implementation by user [zqwnvl]

Version 77

2021-08-16, 03:11:02

Version 78

2021-08-16, 03:37:09

Idiom #28 Sort by a property

Sort elements of array-like collection items in ascending order of x.p, where p is a field of the type Item of the objects in items.

Idiom #28 Sort by a property

Sort elements of array-like collection items in ascending order of x.p, where p is a field of the type Item of the objects in items.

Variables
items,x,p
Variables
items,x,p
Imports
Imports System.Linq
Code
items.OrderBy(Function(x) x.p)
Comments bubble
The LINQ-to-objects extension method OrderBy is available for all IEnumerable(Of T)
Doc URL
https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.orderby
Demo URL
https://sharplab.io/#gist:8cd998231a94debeffdc90d41412e705