I have an IEnumerable<RuleSelection>
with these properties:
public class RuleSelection{
public int RuleId { get; set;}
public int? CriteriaId { get; set; }
public int? CriteriaSourceId{ get; set; }
}
RuleId
in RuleSelection
is not unique.
Can I write a linq query to normalize these into IEnumerable<Rule>
which would be:
public class Rule{
public int RuleId { get; set; }
public IEnumerable<int> Criteria { get; set; }
public IEnumerable<int> CriteriaSource { get; set; }
}
Rule.RuleId
would be unique and the properties Criteria
and CriteriaSource
would include all the CriteriaId
's and CriteriaSourceId
's for the RuleId
respectively.