How do I automatically display all properties of a class and their values in a string?

Viewed 55563

Imagine a class with many public properties. For some reason, it is impossible to refactor this class into smaller subclasses.

I'd like to add a ToString override that returns something along the lines of:

Property 1: Value of property 1\n
Property 2: Value of property 2\n
...

Is there a way to do this?

5 Answers
Related