首页 > 解决方案 > 如何从 C# 中的 API 创建的 IList 中检索数据

问题描述

我正在使用http://jsonutils.com/和 Postman 将数据从 API 预订系统中提取到 C# 中来帮助我创建类。

我可以从类中提取数据,但不能从 Ilist 中提取。有什么建议吗?

下面是使用 in 生成的类和 Ilist 的示例。我可以从 Session 类中提取数据,但不能从 Event 类中提取数据。

//events field
public class Session
{
    public int eventID { get; set; }
    public int companyID { get; set; }
    public object rdPartyID { get; set; }
    public int eventCatID { get; set; }
    public string name { get; set; }
    public string date { get; set; }
    public string time { get; set; }
    public string endDate { get; set; }
    public string endTime { get; set; }
    public object notes { get; set; }
    public int capacity { get; set; }
    public string status { get; set; }
    public int spacesReserved { get; set; }
    public int spacesSold { get; set; }
    public int spacesAvailable { get; set; }
    public int orderCount { get; set; }
    public int reservationCount { get; set; }
    public string sessionType { get; set; }
}

public class Event
{
    public int eventCatID { get; set; }
    public object rdPartyID { get; set; }
    public string name { get; set; }
    public string description { get; set; }
    public string shortDescription { get; set; }
    public object soldOutMessage { get; set; }
    public string image { get; set; }
    public string sessionType { get; set; }
    public int allowSalesDuringSessions { get; set; }
    public int yellowThreshold { get; set; }
    public int amberThreshold { get; set; }
    public int redThreshold { get; set; }
    public string status { get; set; }
    public int navOrder { get; set; }
    public string website { get; set; }
    public object terms { get; set; }   
    public string staffSalesCutoffPointAfterSessionStart { get; set; }
    public object staffSalesCutoffTime { get; set; }
    public int showSessionNames { get; set; }
    public int showRemainingSpaces { get; set; }
    public object capacityNotificationSpacesRemaining { get; set; }
    public object capacityNotificationMessage { get; set; }
    public int showAvailabilityColoursOnDay { get; set; }
    public int customerEditable { get; set; }
    public int amendmentCutoffHoursBeforeEvent { get; set; }
    public string amendmentChargePer { get; set; }
    public string amendmentCharge { get; set; }
    public string amendmentChargeCap { get; set; }
    public string backgroundImage { get; set; }
    public IList<Session> sessions { get; set; }
}

我的基础课程的数据提取很容易提前谢谢你

标签: c#.netlistapivariables

解决方案


推荐阅读