There are 2 classes in the program :
ItemUtility class :
public class ItemUtility
{
public ItemUtility(int item, int utility)
{
this.item = item;
this.utility = utility;
}
public int item { get; set; }
public int utility { get; set; }
}
TransactionTP class :
public class TransactionTP
{
protected List<ItemUtility> itemsUtilities { get; set; }
protected int transactionUtility { get; set; }
public TransactionTP(List<ItemUtility> itemsUtilities, int transactionUtility)
{
this.itemsUtilities = itemsUtilities;
this.transactionUtility = transactionUtility;
}
}
We have defined a list, ( List<TransactionTP> transactions
) and we assigned the value to this collection
With the command below, I get the first line
foreach (TransactionTP b in matrix)
{
matrix[b];
}
How can I get the item and utility of the first line of the first transaction?
According to the photo:
214 + 260 + ...
846 + 552 + ...
I tried the following procedure but it's a mistake :
matrix[a].itemsUtilities[b]