using System;
using System.linq;
using System.Collections.Generic;
namespace MyCompiler {
public class DictionaryItem { public string ID { get; set; } public string Name { get; set; } }
public class Rate { public DictionaryItem VendorType { get; set; } public DictionaryItem JobCost { get; set; } }
public class Vendor { public string ID { get; set; } public string Name { get; set; } public List<Rate> Rates { get; set; } }
class Program {
public static void Main() {
var vendorItems = new List<Vendor>
{
new Vendor
{
ID="v1", Name="Vendor one",
Rates = new List<Rate>
{
new Rate { VendorType = new DictionaryItem{ ID="fuel", Name="Fuel"}, JobCost = new DictionaryItem{ ID="S1", Name="Jet A1"} },
new Rate { VendorType = new DictionaryItem{ ID="FUEL", Name="Fuel"}, JobCost = new DictionaryItem{ ID="S1", Name="Jet A1"} }, // duplicate by case
new Rate { VendorType = new DictionaryItem{ ID="handling", Name="Handling"}, JobCost = new DictionaryItem{ ID="S2", Name="Ramp"} }
}
},
new Vendor
{
ID = "v2", Name = "Vendor Two",
Rates = new List<Rate>
{
new Rate { VendorType = new DictionaryItem{ ID="Fuel", Name="Fuel"}, JobCost = new DictionaryItem{ ID="S3", Name="Avgas"} }
}
}
}
var flattenedRates = vendorItems
.SelectMany
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: