I am using reflection to loop through classes of a DLL and display the properties of that class; but there are cases where the property is another class, and I need to loop through that property's properties and display them.
What I currently have will only display the properties, and not sub properties:
treeView1.Nodes.Clear();
Assembly assembly = Assembly.LoadFrom(@"Path\Domain.dll");
int count = 0;
foreach (Type type in assembly.GetTypes().Where(t => t.IsClass))
{
var node = treeView1.Nodes.Add(type.FullName);
var x = ((System.Reflection.TypeInfo)((assembly.GetTypes()))[count]).DeclaredProperties;
x.ToList().ForEach(item => treeView1.Nodes[count].Nodes.Add(item.Name));
count++;
}
}
Any help to display sub properties
Aucun commentaire:
Enregistrer un commentaire