I am using the SelectMany method to create a combination of items from two list of strings. I am able to create the flattended list without any issues, but unable to figure out how to add the index. In the example below, I need to assign the Position property of Product with the Index.
var strings = new List<string> { "Milk", "Eggs", "Cheese" };
var suffixes = new List<string> {"-Direct", "-InDirect"};
var products = strings
.SelectMany((_, index) => suffixes,
(x, y) => new Product {Position = ?, ID = x + y});
Thanks for any help,