Example
public class MyItems
{
public object Test1 {get ; set; }
public object Test2 {get ; set; }
public object Test3 {get ; set; }
public object Test4 {get ; set; }
public List<object> itemList
{
get
{
return new List<object>
{
Test1,Test2,Test3,Test4
}
}
}
}
public void LoadItems()
{
foreach (var item in MyItems.itemList)
{
//get name of item here (asin, Test1, Test2)
}
}
**
I have tried this with reflection.. asin typeof(MyItems).GetFields() etc.. but that doesn’t work.
How can I find out which name “item” has? Test1? Test2?? etc…
The above will give you an Enumerable of properties name.
if you want to get the name of the properties in the list use:
EDIT:
From your comment, may be you are looking for :