csharp linq sorting sequential guids

Code Example - csharp linq sorting sequential guids

                
                        // https://stackoverflow.com/questions/48806510/descending-order-in-listguid-is-different-then-iqueryable-orderbydescending
// A cast to System.Data.SqlTypes.SqlGuid is needed to perform the same in-memory linq-sorting-result in comparison to SQL-Server sorting of UNIQUEIDENTIFIER
yourCollection.OrderBy(x => new SqlGuid(x.YourGuid))