This code:
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(lst[0])) { Console.WriteLine(descriptor.Name); }
will write out the name of all the items in my list. That is, FirstName / LastName or something else. How to write out children of an element? If there was an βCarsβ element on my list that had the type and color of the car, how would I use TypeDescriptor to write it?
What I got at the moment:
I want something like this:
- Firstname
- Lastname
- Car: Toyota, Red
- Car: Mitsubishi, Green
Does anyone know how to do this?
source share