Use o.GetType().GetProperties() Then use the PropertyInfo.PropertyType property to make sure it is a string. Then, for the foreach property, call GetValue (o, null)
props = o.GetType().GetProperties() PropertyInfo prop = props(0) Console.WriteLine (prop.Name & " = " & prop.GetValue (o, Nothing))
source share