¿Cómo funciona IOrderedEnumerable.ThenBy () en .Net?

Quiero entender cómo funciona ThenBy en .Net. (Sé cómo usarlo, ¡no entiendo cómo lo implementó Microsoft!)

Según la documentación,string_list.OrderBy(Function (x) x.length).ThenBy(Function (x) x) debe mostrar una lista de cadenas ordenadas por longitudy entonces alfabéticamente. ¿Cómo podría funcionar? El primer ordenamiento es por longitud. ¡El segundo ordenamiento debería deshacer la clasificación del primero!

Asume este código:

Dim sorted_by_length As IOrderedEnumerable(Of String)
sorted_by_length = string_list.OrderBy(Function (x) x.length)
sorted_by_length = sorted_by_length.ThenBy(Function

Aquí estoy yo tratando de implementar la última línea sin usarThenBy:

Dim sorted_by_length As IOrderedEnumerable(Of String)
sorted_by_length = string_list.OrderBy(Function (x) x.length)
'my implementation of OrderBy:
Dim e as IEnumerator(Of String) = sorted_by_length.GetEnumerator
Do While e.MoveNext
    'I have no idea what to write here!
Loop

Aquí hay algo de magia ... ¿Existe alguna función e.GetPreviousKeySelector ()? De hecho, ni siquiera puedo escribir una función que devuelva IOrderedEnumerable!

Respuestas a la pregunta(1)

Su respuesta a la pregunta