The fourth video in my Exploring MoreLINQ series looks at the
Cartesian methods, which are all related to calculating combinations of items.
Permutations enumerates all possible orderings of the items in the input sequence.
Subset gives you every possible subset of the input sequence, including the empty subset, and the subset of all items. This is also sometimes known as a "powerset", and you can ask for only subsets of a certain size. Finally there's
Cartesian allowing you to find all the combinations of picking one item from each of two or more sequences.
Some "real-world" examples of when these methods come in handy are when I needed to work out what containers to use to hold 150 litres of eggnog which required powersets, or solving the travelling salesman problem with
You can find all videos in this series here.