Using GetValue inside of Where clause

You should cast that object to actual type of the property. In this case, it is an int. In addition, you don’t need the other null parameter. Just GetValue(yourObject) will work. You call it and cast it to the type of your property.

Try this:

var returnValues = champions.data.Values
    .Where(x => (int) (x.info.GetType()
        .GetProperty(property)
        .GetValue(x.info)) > value);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top