I\'m trying to generate a table in a razor view using reflection to pull the properties from the model.
Here is what I\'ve tried:
@if (@Model.Count() &
So basically I need to access the value of a property of item based on the name of the property stored in a variable.
No, you need to access the value of a property based on a PropertyInfo object describing it. That's far far easier.
PropertyInfo
property.GetValue(item)