I've tried for 2 days to find something that will work and none of the examples I have found are working.
What I need is to be able to get a list of public properties from an instantiated class.
For Instance:
MyClass has the following definition:
public class MyClassSample : MyDC
{
public string ReportNumber = "";
public string ReportDate = "";
public MyClassSample()
{
}
}
What I need is a way to simply return an array that has ["ReportNumber"]["ReportDate"] in it from the above class.
Here is my most recent attempt, just to add the property names to a string:
string cMMT = "";
Type t = atype.GetType();
PropertyInfo[] props = t.GetProperties();
List<string> propNames = new List<string>();
foreach (PropertyInfo prp in props)
{
cMMT = cMMT + prp.Name + "\n";
}
I think I am missing something basic and simple, but for some reason I cannot see it right now. Any help would be appreciated.