Say I have a method definition as such:
public CustomerOrderData[] GetCustomerOrderData(string[] CustomerIDs)
{
var query = (from a in db.Customer
join b in db.Order on a.CustomerID equals v.CustomerID
orderby CustomerIDs
select new CustomerOrderData()
{
//populate props here
}).ToArray();
}
My CustomerIDs in input param could be {"1","3","400","200"}
I want my return array to be ordered in the above fashion. Is there an easy way to achive this?
My solution was to put it into a Dictionary and then create a new array while looping through my CustomerIDs collection.
CustomerOrderData does have a property named CustomerID