title: how to pass in multiple properties as parameters and then use them properly?
body: <p>I got this generic method;</p>
  
  <pre><code>public CompareResult&lt;T&gt; GenericCompare&lt;T&gt;(CompareLogic compareLogic, List&lt;T&gt; OldObject, List&lt;T&gt; NewObject, Func&lt;T, int&gt; DelProperty)
  {
      var result = new CompareResult&lt;T&gt;();
  
      var OldObjectId = OldObject.Select(DelProperty);
      var NewObjectId = NewObject.Select(DelProperty);
  
      var ObjectAddedId = NewObjectId.Except(OldObjectId);
      var ObjectRemovedId = OldObjectId.Except(NewObjectId);
  
      var SameOldObject = OldObject.Where(x =&gt; !ObjectRemovedId.Contains(DelProperty(x)));
      var SameNewObject = NewObject.Where(x =&gt; !ObjectAddedId.Contains(DelProperty(x)));
  
      var SameObject = SameOldObject.Join(
                                              SameNewObject,
                                              Older =&gt; DelProperty(Older),
                                              Newer =&gt; DelProperty(Newer),
                                              (Older, Newer) =&gt; new { older = Older, newer = Newer }
                                          );
  
      foreach (var same in SameObject)
      {
          var ObjectCompare = compareLogic.Compare(same.older, same.newer);
          if (!ObjectCompare.AreEqual)
          {
              var Modified = ObjectCompare.Differences.Select(x =&gt; x.PropertyName);
              result.ObjectModified.Add(new Tuple&lt;T, T, IEnumerable&lt;string&gt;&gt;(same.older, same.newer, Modified));
          }
      }
      result.ObjectRemoved = OldObject.Where(x =&gt; ObjectRemovedId.Contains(DelProperty(x))).ToList();
      result.ObjectAdded = NewObject.Where(x =&gt; ObjectAddedId.Contains(DelProperty(x))).ToList();
  
      return result;
  }
  </code></pre>
  
  <p>for the <code>DelProperty</code> parameter I can have these combinations;</p>
  
  <ol>
  <li>one field, int (current code)</li>
  <li>two fields, int, int</li>
  <li>two fields, string, string</li>
  </ol>
  
  <p>the parameter <code>DelProperty</code> is like a primary key of the object, what would i need to do to make this code compatible with "composite" primary key? I'm kind of stuck at this point.</p>
  
  <p>the only thing that i can think of is to copy/paste this code twice to implement the 2 missing combinations but I'm afraid that more combinations will come and this could get messy pretty easily</p>