using System.Collections.Generic;
public List<Option> Options { get; set; }
public List<List<string>> GetAllCombinations()
if (Options == null || !Options.Any())
var combinations = new List<List<string>> { new() };
foreach (var option in Options)
combinations = combinations
.SelectMany(combination => option.Values
.Select(optionValue => new List<string>(combination) { optionValue }))
public string Name { get; set; }
public List<string> Values { get; set; }
public static void Main()
new() { Name = "Color", Values = new() { "Blue", "Yellow", "Green" } },
new() { Name = "Memory", Values = new() { " 32 GB", " 64 GB", "128 GB" } },
new() { Name = "Display", Values = new() { " HD", "FHD", "UHD" } },
var combinations = product.GetAllCombinations();
foreach (var combination in combinations)
Console.WriteLine(string.Join("", combination.Select(comb => comb.PadRight(10))));