class MenuInfo : IComparable
{
public int order { get; set; }
public string menuid { get; set; }
public int CompareTo(object obj)
{
int result;
try
{
MenuInfo menuInfo = obj as MenuInfo;
if (this.order >= menuInfo.order)
{
result = 1;
}
else
{
result = -1;
}
return result;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
原文:https://www.cnblogs.com/whisful/p/12303924.html