I'm trying to put multiple values (arrays) in a key, but I do not know how to do this.
I've tried:
public class Customer
{
public string Name { get; set; }
public string Bought[5] { get; set; }
}
List<Customer> Products = new List<Customer>();
Customer product = new Customer();
product.Bought[0] = listproducts.SelectedIndex;
product.Bought[1] = listproducts.SelectedIndex;
product.Bought[3] = listproducts.SelectedIndex;
product.Bought[4] = listproducts.SelectedIndex;
product.Bought[5] = listproducts.SelectedIndex;
I know this is wrong, but is a poor example for what I'm trying to do.
I was trying something by this way:
Store multiple values in single key in json
But I do not know how to adapt to C#.
I just need to save to the JSON file something like:
[{"Name":"Bryan", "Products":"car", "boat", "bike"}]
If someone is able to help me, I would be grateful. I would give this further step toward knowledge.