Open sandboxFocus

Method WithDeterministicOrder

WithDeterministicOrder<T>(IEnumerable<T>)

Sorts a sequence of IDeclaration in a deterministic order. The specific order is an implementation detail; it is guaranteed to be stable across builds but is not part of the public contract. Sort key: Depth, then containing declaration (recursively), then name, then signature (for overloadable members). Useful in aspects to make generated code independent of source declaration order.

Declaration
public static IOrderedEnumerable<T> WithDeterministicOrder<T>(this IEnumerable<T> source) where T : class, IDeclaration
Parameters
Type Name Description
IEnumerable<T> source

The sequence to sort.

Returns
Type Description
IOrderedEnumerable<T>

A new sequence sorted in deterministic order.

Type Parameters
Name Description
T

The element type, which must implement IDeclaration.