私は次のクラスを持っています
namespace TaxiResults.Model
{
public class SearchResult
{
public string status { get; set; }
public SearchResultResult result { get; set; }
}
public class SearchResultResult
{
public SearchResultOffer offer { get; set; }
}
public class SearchResultOffer
{
public SearchResultOffer1[] offers { get; set; }
}
public class SearchResultOffer1
{
public SearchResultAddress[] addresses { get; set; }
public string chnl { get; set; }
public string companyInfoId { get; set; }
public string companyName { get; set; }
public string bookingId { get; set; }
public string tz { get; set; }
public string pickupDateTime { get; set; }
public string pickupDateTimeUTC { get; set; }
public int routeDuration { get; set; }
public int routeDistance { get; set; }
public SearchResultPricedetail priceDetail { get; set; }
public float tax { get; set; }
public string services { get; set; }
public int bagCount { get; set; }
public int passengerCount { get; set; }
public int productType { get; set; }
public string resultset { get; set; }
public string companyInfoId3cd { get; set; }
}
public class SearchResultPricedetail
{
public SearchResultOriginalprice originalPrice { get; set; }
public SearchResultFinalprice finalPrice { get; set; }
}
public class SearchResultOriginalprice
{
public SearchResultAmount[] amounts { get; set; }
}
public class SearchResultAmount
{
public string currency { get; set; }
public string priceExcludingTax { get; set; }
public float priceExcludingTaxNumber { get; set; }
public string priceTotal { get; set; }
public float priceTotalNumber { get; set; }
public float exchangeRate { get; set; }
public string priceTax { get; set; }
public float priceTaxNumber { get; set; }
}
public class SearchResultFinalprice
{
public SearchResultAmount1[] amounts { get; set; }
}
public class SearchResultAmount1
{
public string currency { get; set; }
public string priceExcludingTax { get; set; }
public float priceExcludingTaxNumber { get; set; }
public double priceTotal { get; set; }
public float priceTotalNumber { get; set; }
public float exchangeRate { get; set; }
public string priceTax { get; set; }
public float priceTaxNumber { get; set; }
}
public class SearchResultAddress
{
public SearchResultLocation location { get; set; }
public string address { get; set; }
public int type { get; set; }
}
public class SearchResultLocation
{
public float lat { get; set; }
public float lng { get; set; }
}
}
Taxi.Model.SearchResult
foreach ループを実行して、MVC ビューで返すモデルにフィードしたいと考えていました。
しかし、私はエラーが発生します:
「Taxi.Model.SearchResult」には「GetEnumerator」のパブリック定義が含まれていないため、foreach ステートメントは「Taxi.Model.SearchResult」型の変数を操作できません
c#.net を初めて使用する人は、foreach を実行できるようにするために何をする必要があるか教えてもらえますか?
ありがとう