I'm looking for a class that can output an object and all its leaf values in a format similar to this:
User
- Name: Gordon
- Age : 60
- WorkAddress
- Street: 10 Downing Street
- Town: London
- Country: UK
- HomeAddresses[0]
...
- HomeAddresses[1]
...
(Or a clearer format). This would be equivalent to:
public class User
{
public string Name { get;set; }
public int Age { get;set; }
public Address WorkAddress { get;set; }
public List<Address> HomeAddresses { get;set; }
}
public class Address
{
public string Street { get;set; }
public string Town { get;set; }
public string Country { get;set; }
}
A kind of string representation of the PropertyGrid control, minus having to implement a large set of designers for each type.
PHP has something that does this called var_dump. I don't want to use a watch, as this is for printing out.
Could anyone point me to something like this if it exists? Or, write one for a bounty.