help
Root Question Message
var s = new Ship();
s.Name = "Carrots"; // this uses the setter
var n = s.Name; // this uses the getter
var ships = new List<Ship>(){
new Ship {
Name = "Carrots",
Price = 12.9,
Quantity = 89,
Address = "18 Boulevard Avenue, Boroughshire",
ShippingType = "Super Ultra Express",
PayType = "Bags of rye"
},
new Ship {
Name = "Carrots",
Price = 12.9,
Quantity = 89,
Address = "18 Boulevard Avenue, Boroughshire",
ShippingType = "Super Ultra Express",
PayType = "Bags of rye"
},
};
ships.Add(new Ship {
Name = "Carrots",
Price = 12.9,
Quantity = 89,
Address = "18 Boulevard Avenue, Boroughshire",
ShippingType = "Super Ultra Express",
PayType = "Bags of rye"
});
var json = JsonSerializer.Serialize(ships);
File.WriteAllText("my-data.json", json);
names = [ "bob", "anna", "joel" ]
numbers = [ 12343245, 4567567, 4564564 ]
people = [
{ name: "bob", number: 12343245 },
{ name: "anna", number: 4567567 },
{ name: "joel", number: 4564564 }
]
var ships = new List<Ship>();
for (var i = 0; i < someList.Length, i++)
{
ships.Add(new Ship {
Name = namesList[i],
Price = pricesList[i],
Quantity = quentitiesList[i],
// etc...
});
}
my-data.json
is the path