mardi 6 décembre 2016

Expression of type parameters passing from typed parameter?

How to generalize the expression y.Aaa == x.Aaa in the following method?

void Delete<T>(List<T> db, List<T> n, Func<bool> cond) // typed cond
{
    var deleted = db
        .Where(x => !n.Any(y => y.Aaa == x.Aaa)) // Each T may have different property name? 
        .ToList();
    //....
}

If it cannot be done. How about Delete(db, n, db => db.Aaa, n => n.Aaa)?





Aucun commentaire:

Enregistrer un commentaire