I'm looking for a C# example that will give me all subsets of a set while respecting the order.
For example I have A,B and would like:
A
B
AB
BA
Please note that for my purpose AB != BA
.
The solution should be generic for any input type:
List<List<T>> GetSubsets<T>(List<T> originalSet)
I've come across some great solutions using bitwise manipulation for AB == BA (e.g Generate all combinations for a list of strings) but so far I have failed to find anything to solve what I described above.
Any tips/pointers would be much appreciated!