Permutations with Iterators in C#03 Sep 2015
I recently ran across a need to generate all permutations of an array of objects in some unit testing I was doing.
The specific situation was testing that, no matter what the order, when certain messages were picked up by an NServiceBus Saga, that a certain state was consistent after all messages were received. Since I explicitly wanted to test the state no matter what order the messages arrived in, I needed all permutations of those messages so I could send them to the Saga in each order and test the resulting state.
I found this super article on the subject that gave all the code I needed: Generating Permutations with C# Iterators.
Thanks IanG on Tap!