Я мог бы иметь несколько (до 5) IEnumerable<ResortSupplier>
и хотел бы объединить их в одну IEnumerable<ResortSupplier>
группировку по SupplierCode. Мои объекты выглядят так:
Вот мои объекты:
[Serializable]
public class ResortSupplier
{
public string SupplierCode { get; set; }
public IList<Product> ResortProducts { get; set; }
}
[Serializable]
public class Product
{
public string Code { get; set; }
//Other fields...
public IList<PerPricing> PricingDetail { get; set; }
}
[Serializable]
public class PerPricing
{
//Other fields..
public decimal? Price { get; set; }
public Error PricingError { get; set; }
}
Данные в нескольких IEnumerable могут выглядеть следующим образом:
----------------------------------------
IEnumerable<ResortSupplier> - 1
Hyatt Resort
Standard Room
PricingDetail-1
Superior Room
PricingDetail-1
Sandals Resort
Standard Room
PricingDetail-1
Delux Room
PricingDetail-1
----------------------------------------
IEnumerable<ResortSupplier> - 2
Hyatt Resort
Standard Room
PricingDetail-2
Superior Room
PricingDetail-2
One Bed Room Suit
PricingDetail-2
Sandals Resort
Standard Room
PricingDetail-2
Honeymoon Suit
PricingDetail-2
----------------------------------------
IEnumerable<ResortSupplier> - 3
.....
----------------------------------------
IEnumerable<ResortSupplier> - 4
.....
----------------------------------------
IEnumerable<ResortSupplier> - 5
.....
----------------------------------------
Мой сводный результат должен содержать:
IEnumerable<ResortSupplier> - Consolidated
Hyatt Resort
Standard Room
PricingDetail-1
PricingDetail-2
Superior Room
PricingDetail-1
PricingDetail-2
Bed Room Suit
PricingDetail-2
Sandals Resort
Standard Room
PricingDetail-1
PricingDetail-2
Delux Room
PricingDetail-1
Honeymoon Suit
PricingDetail-2
----------------------------------------
Какой лучший способ справиться с этим? Я попробовал простые предложения IEnumerable.Union и GroupBy, но не получил желаемых результатов.