public static IEnumerable<IList<T>> Permutations<T>(
this IEnumerable<T> sequence
)
<ExtensionAttribute>
Public Shared Function Permutations(Of T) (
sequence As IEnumerable(Of T)
) As IEnumerable(Of IList(Of T))
public:
[ExtensionAttribute]
generic<typename T>
static IEnumerable<IList<T>^>^ Permutations(
IEnumerable<T>^ sequence
)
[<ExtensionAttribute>]
static member Permutations :
sequence : IEnumerable<'T> -> IEnumerable<IList<'T>>
A permutation is a unique re-ordering of the elements of the sequence.
This operator returns permutations in a deferred, streaming fashion; however, each permutation is materialized into a new list. There are N! permutations of a sequence, where N ⇒ sequence.Count().
Be aware that the original sequence is considered one of the permutations and will be returned as one of the results.