I have an dynamic array, containing for example (int) {1, 2, 3}
I would like to generate the following:
123
132
213
231
312
321
(note the sorting)
I was thinking of building 3 loops for the above, but that solution doesn’t come up well when the array length is 16 for example, and I need a dynamic solution.
Can you help? Thank you. This is for a personal project.
You can use the Permutations Extension Method from the excellent EvenMoreLINQ project.
Example:
Output: