I have a client class and one of the properties is Emails which is a list of strings. I can loop through the properties of the class to output the values, but when it gets to the Emails property it doesn’t loop through the emails because it needs to do another loop through the list.
foreach (PropertyInfo prop in oClient.GetType().GetProperties())
{
if (prop.Name.ToUpper().ToString() == "EMAILS")
{
//need code to loop through emails
}
else
{
Response.Write("<b>" + prop.Name.ToString() + "</b>: " + prop.GetValue(oClient, null) + "<br />");
}
}
You can read the value of Emails using
and then iterate through that, e.g.