问题描述
publicclassSortedNumber:IComparable<SortedNumber>{publicSortedNumber(stringnum,boolisUrgent,intwave,intallTime){this.num=num;this.isUrgent=isUrgent;this.wave=wave;this.allTime=allTime;}#regionPropertiesprivateintwave;publicintWave{get{returnthis.wave1;}set{this.wave1=value;}}privateintallTime;publicintAllTime{get{returnthis.allTime;}set{this.allTime=value;}}privateboolisUrgent;publicboolIsUrgent{get{returnthis.isUrgent;}set{this.isUrgent=value;}}privatereadonlystringnum;publicstringNum{get{returnthis.num;}}#endregion#regionMembersofIComparablepublicintCompareTo(SortedNumberother){if(other.isUrgent)return1;if(other.wave>this.wave)return1;if(other.allTime>this.allTime)return1;returnthis.num.CompareTo(other.num);}
我使用SortedNumber这个类作为SortedList的键值,实现按照先后isUragent,wave,allTime,Num排序。我自己这个CompareTo算法是错误的,请高手给出正确的算法。
解决方案
解决方案二:
这么快就沉下去了
解决方案三:
自己顶下
解决方案四:
下班前顶一下,希望有达人帮解决
解决方案五:
看过,顶过