using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace Utility
{
public class ClassBase
{
public override string ToString()
{
Type type = this.GetType();
System.Reflection.PropertyInfo[] propertyInfos = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
var q = (from p in propertyInfos
where p.CanRead && p.GetIndexParameters().Length == 0
let value = p.GetValue( this, null )
select p.Name + "="+ (value != null ? value : string.Empty).ToString() );
return string.Join( "; ", q );
}
}
}