I may be missing basic knowledge here, but i ll go for it and ask it.
Lets say we have an array of strings:
ItemCode
ItemDescription
and we have a class:
public class InventoryItem
{
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
}
I want to be able to reference the properties of an InventoryItem dynamically based on the values of the array.
I need to loop through the array and get the value of the property of the class by the current string member of the array.
How can i do it?
You use reflection:
See:
Type.GetPropertyType.GetProperties(to find them all)PropertyInfo.GetValue