I am new to the reflection area. I am have to filter a list of entity that has a dictionary by using it's key and value like below
public class Person
{
public string Name { get; set; }
public Dictionary<string,string> SecQuestions { get; set; }
}
below extension is available in a dll and could not be modified
public static class extensions
{
public static List<Person> FilterMe(this List<Person> Persons, Func<Person,bool> predicate)
{
// Logic to filter the persion list
return Persons;
}
}
hence I have to call the above method by using below code
persons.FilterMe(xy => xy.SecQuestions.Any(x => x.Key == "PlaceOfBirth" && x.Value == "Madurai"));
I need to know how to create
xy => xy.SecQuestions
.Any(x => x.Key == "PlaceOfBirth" && x.Value == "Madurai")
dynamically using expression builders to pass as the parameter to the extension method. Thanks
Aucun commentaire:
Enregistrer un commentaire