public int CompareTo(object obj)
{
int result;
try
{
CharacterItem info = obj as CharacterItem;
if (id > info.id)
result = 1;
else if(id == info.id)
result = 0;
else
result = -1;
return result;
}
catch (Exception ex) { throw new Exception(ex.Message); }
}
技术分享:继承IComparable 实现类根据其中ID排序
最新推荐文章于 2022-02-09 08:05:02 发布