/* Developer: Tyler Allen Date Created: 08/24/2016 --------------------------------------------------- */ using System.Linq; using System.Text; namespace CPE.App.Notify.Models.Partials { /// /// This base class is used to override the ToString() method. /// ToString() will output all properties and their values. /// public class PartialBaseClass { public override string ToString() { var output = new StringBuilder(); var currentType = GetType(); var properties = currentType.GetProperties() .Where(x => !x.PropertyType.IsClass) .OrderBy(x => x.Name); foreach (var property in properties) { output.AppendFormat("{0}={1}, ", property.Name, property.GetValue(this, null)); } return output.ToString(); } } }