title: Is there an Algorithm to index a collection on permutation of properties?
body: <p>Given:</p>
  
  <pre><code>IMatchCriteria {
      string PropA{get;}
      string PropB{get;}
      int? PropC {get;}
      int? PropD {get;}
  }
  
  IReportRecord : IMatchCriteria {...}
  
  IMatchCriteriaSet : IMatchCriteria {
      int MatchId {get;}
      double Limit{get;}
  }
  
  public class Worker{
  
  private List&lt;IMatchCriteriaSet&gt; _matchers = GetIt();
  //Expecting this list to be huge, ***upto 0.1m***. Some of the sample matchers:
  // MatchId=1, Limit=1000, PropA=A, PropC=101, PropD=201
  // MatchId=2, Limit=10,   PropA=A
  // MatchId=3, Limit=20,            PropC=101
  // MatchId=4, Limit=500,                      PropD=201
  
     //Based on sample entries:
     //Input: reportRecord{ PropA=A, PropC=101 }, Ouput: 1000, 20
     //Input: reportRecord{ PropA=A1, PropC=102, PropD=201 }, Ouput: 500
      public IEnumerable&lt;double&gt; GetMatchingLimits(IReportRecord reportRecord) {
           //Bad, very bad option:
           foreach(var matcher in _matchers){
               var matchFound=true;
               if(reportRecord.PropA!=null &amp;&amp; reportRecord.PropA!=matcher.PropA){                
                   continue;
               }
               if(reportRecord.PropB!=null &amp;&amp; reportRecord.PropA!=matcher.PropB){
                   continue;
               }
               if(reportRecord.PropC!=null &amp;&amp; reportRecord.PropC.Value!=matcher.PropC.Value){
                   continue;
               }
               if(reportRecord.PropD!=null &amp;&amp; reportRecord.PropD.Value!=matcher.PropD.Value){
                   continue;
               }
               yield return matcher.Limit;
           }
      }
  
      }
  </code></pre>
  
  <p>Note: Expecting IMatchCriteriaSet to be 0.1m records.
  Expecting GetMatchingLimits to be called 1m times.
  The requirement is to do all this for a real-time application.</p>
  
  <p>Essentially what I need is a way to index list of IMatchCriteria. But can not use Dictionary because my key is not defined.
  Looking for some algorithm to tackle this problem <strong><em>efficiently</em></strong>. </p>
  
  <p>Any suggested solution in scope of .net (not just c#) would be useful.</p>
  
  <p>Thanks.</p>