public int Compare(object x, object y)
{
//Dynamically get the protery info based on the protery name
PropertyInfo propertyInfo = ObjectType.GetProperty(sortcolumn);
//Get the value of the instance
IComparable obj1 = (IComparable)propertyInfo.GetValue(x,null) ;
IComparable obj2 = (IComparable)propertyInfo.GetValue(y,null) ;
//Compare based on the sorting order.
if(sortingOrder == 0)
return ( obj1.CompareTo(obj2) );
else
return ( obj2.CompareTo(obj1) );
}