I am new to C#, from a C++ background. I am trying to write a generic ToString() fn for my types that will dump member variables to string, for diags.
I have a routine that will dump out 'this' object's member variables and properties, and that works well. Ideally, I would like to set up some recursion so that ToString() is inherited, and when it is called from a derived type, the derived type's members are dumped, then the base type members, then the base-of-the-base type's members, etc, down to System.Object.
So, how do I call the base class' ToString() ?
I have tried using the 'base' operator, but the virtual mechanism re-routes the function to 'this'. I am thinking that I would have to get the current type, via reflection, and then get the base type from this somehow, and then set up a local reference that is cast to the base type, and call the ToString() function on that.
Thanks in advance for your help.