Drop In Reflection Based Tostring Method
using System.Reflection;

...

        public override string ToString() {
            StringBuilder sb = new StringBuilder();

            sb.Append(this.GetType().ToString() + ": {");
            sb.Append("Foo: {");
            foreach (PropertyInfo p in this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
                sb.Append(p.Name + ": " + p.GetValue(this, null) + "; ");
            }
            sb.Append("}");
            return sb.ToString();
        }
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License