I have two methods that are fairly similar. I want to return entities based on whether one of its properties is null or an empty string. However, the properties of the entities are not shared. All properties are strings.
public List<Phone> GetPhones(){
return context.Phones
.Where(p=> !(p.Number == null
|| p.Number.Trim() == String.Empty))
.ToList();
public List<Remote> GetRemotes(){
return context.Remotes
.Where(r => !(r.OEM == null
|| r.OEM.Trim() == String.Empty))
.ToList();
}
Is it possible to create a method like:
public List<T> GetEntities(string property){
return ...
}