public class PCE
{
public string ActivityType { get; set; }
public string ActivitySubtype { get; set; }
public int Id { get; set; }
}
public class ActionLimit
{
public string PropertyName { get; set; }
public string PropertyValue { get; set; }
public int Nos { get; set; }
}
我有一个PCE的集合。说 -
PCE pce = new PCE();
pce.ActivityType = "Sales";
pce.ActivitySubtype = "Loan2";
pce.Id = 1;
listPCE.Add(pce);
pce = new PCE();
pce.ActivityType = "Sales";
pce.ActivitySubtype = "Loan1";
pce.Id = 2;
listPCE.Add(pce);
pce = new PCE();
pce.ActivityType = "Sales";
pce.ActivitySubtype = "Subcat";
pce.Id = 3;
listPCE.Add(pce);
pce = new PCE();
pce.ActivityType = "Loyalty";
pce.ActivitySubtype = "Loan";
pce.Id = 4;
listPCE.Add(pce);
我有一系列ActionLimits。说 -
ActionLimit al = new ActionLimit();
al.PropertyName = "ActivityType";
al.PropertyValue = "Sales";
al.Nos = 2;
listActionLimit.Add(al);
al = new ActionLimit();
al.PropertyName = "ActivitySubtype";
al.PropertyValue = "Loan";
al.Nos = 1;
listActionLimit.Add(al);
问题陈述:我需要算法来限制ActionLimit“Nos”属性的PCE集合。在上面的例子中,我需要将PCE限制为2个Sales ActivityType和1个Loan ActivitySubtype。算法需要足够通用的PCE的任何属性(不仅仅是ActivityType和ActivitySubtype)。此外,各种ActionLimits的结果应该是AND。 (所以在上面的示例中 - 在2 Sales PCE中,如果其中一个不是Loan ActivitySubtype,则将其排除在外。)