I am using Reflection to get values on basis of specified dynamic column name(model property).

My issue is when i pass propName, it is in All Caps, if i convert it in LowerCase(), still it doesn't match with the Model property.

Here is Code :-

public object GetPropValue(object obj, string propName)
     return obj.GetType().GetProperty(propName).GetValue(obj, null);

 var Fields = obj.GetPropValue(Employee, item.Key);  // item.key = 'ADDRESS'

public class Employee
      public string Address { get; set; }

What is solution for this?

Related posts

Recent Viewed