vendredi 31 mars 2017

Filter a list of objects with objects inside dinamically

I have an object scores like this

public class Score{
    public Client _client { get; set; }
    public Offer _offer{ get; set; }
    public float _scoreValue { get; set; }
}

Afterwards this class is used in a List<Score> scores, now I want to dynamically filter the List using properties of the client or the offer. The data structure that feeds this filters knows this.

For example I want to filter the list of scores based on client.name ==JohnDoe LINQ is not an option because the property that I am going to use to filter in each case is different.

I already did some research and found out that Expressions Tree are the way to go, but I have some difficulty implementing it.





Aucun commentaire:

Enregistrer un commentaire