I have a list thus:
List<Option> OptionList = getOptions();
an Option has various properties but the important ones are
decimal Price
string EqtCode
I then have a second list thus:
List<string> EqtCodes
What I am trying to do is grab options from OptionList where their EqtCode matches ALL the ones in the EqtCodes list.. BUT, to make it more complicated I actually need them to be grabbed in 'sets' of ALL of the items in the EqtCodes list, picking the LOWEST price of any duplicates but grabbing them in SETs of everything in the EqtCodes list so.. to attempt to explain further
say the eqtCodes has the following in it
['A','B','C']
and the optionList has
{['A',99.99],['A',89.99],['B',20.00],['C',35.00'],['C',30.00]}
What I need is ONLY
['A',89.99],['B',20.00],['C',30.00']
i dont want it to grab all of the A's and B's and C's unless it gets them in lumps of 1 A, 1 B and 1 C
selected out currently I have
var whatIwant = OptionList.Where(o=>o.EqtCode.In(EqtCodes));
sadly this will grab everything, not to mention ignore the price.. likewise, if the optionlist was
{['A',99.99],['A',89.99],['B',20.00],['C',35.00'],['C',30.00],['B',22.00],['F',33.33], ['B',19.99]}
it would need to grab
{['A',99.99],['A',89.99],['B',20.00],['C',35.00'],['C',30.00],['B',19.99]}
so its basically grabbing 'full sets' of ALL of the items in the EqtCodes list each time
I am sure LINQ could do this, but I cannot :)
as ever any help much appreciated
thanks