カタログ内の各製品のすべての可能な製品オプション/値の組み合わせのリストを生成しようとしています。各製品は、可変数のオプションを持つことができ、各オプションは可変数の値を持つことができます。結果セットを連結する
たとえば、シャツがあり、オプション/値が色(赤、黄、青)、サイズ(s、m、l)、素材(綿、ナイロン、ブレンド)だったとします。私はこのようになりますリストを生成したい:
red, s, cotton
red, s, nylon
red, s, blend
red, m, cotton
red, m, nylon
red, m, blend
red, l, cotton
red, l, nylon
red, l, blend
yellow, s, cotton
yellow, s, nylon
yellow, s, blend
yellow, m, cotton
yellow, m, nylon
yellow, m, blend
yellow, l, cotton
yellow, l, nylon
yellow, l, blend
blue, s, cotton
blue, s, nylon
blue, s, blend
blue, m, cotton
blue, m, nylon
blue, m, blend
blue, l, cotton
blue, l, nylon
blue, l, blend
私は理論的には、これは結果の多くを生成することができることを知っているが、実際には製品のほとんどは、2つのまたは3の値を持つ2つのまたは3つのオプションを持っています各。
私はC#で作業していますが、どのようなコード例も非常に役に立ちます。ご提案ありがとうございました!
これらの回答の中には、使用している.Netのバージョンが重要です。 Tupleを使用するものは4.0、LINQを使用するものは3.5+を必要とします。 –