我有以下代码。如何为此属性添加值?
APIKarhoBookingProperties objbooking = new APIKarhoBookingProperties();
objbooking.currency = "USD";
objbooking.price_components = ??? //how to add values this section
class APIKarhoBookingProperties
{
public string currency { get; set; }
public List<PriceComponent> price_components { get; set; }
}
public class PriceComponent
{
public string component_name { get; set; }
public double value { get; set; }
public string description { get; set; }
public string currency { get; set; }
}
答案 0 :(得分:1)
阅读一些c#基础知识,List
price_components.Add(new PriceComponent(){
component_name = "name",
value = 2,
description = "dgfdgf",
currency = "USD" });
答案 1 :(得分:1)
var id = context.MakeMessage().ConversationId;