SortedList类默认是升序的,要改成降序要怎么改呢?
通过实现IComparer:
public class ReverserSort : IComparer<string>
{
private bool Asc=true;
int IComparer<KeyValueItem>.Compare(string x, string y)
{
if (Asc)
return string.Compare(x, y);
else
return string.Compare(y, x);
通过实现IComparer:
public class ReverserSort : IComparer<string>
{
private bool Asc=true;
int IComparer<KeyValueItem>.Compare(string x, string y)
{
if (Asc)
return string.Compare(x, y);
else
return string.Compare(y, x);
}
public bool bAsc
{
set { Asc = value; }
}
}
其中string类型也可以是其他类型
ReverserSort ms = new ReverserSort();
ms.Asc = false;
SortedList li = new SortedList();
Array.Sort(li, ms);
-----------------------------------------
去除SortedList的自动排序功能
【t042】炮击坦克
Multiple address space mapping technique for shared memory wherein a processor operates a fault handling routine upon a translator miss
阿里云平台
OpenShift:外国的免费云平台
注册亚马逊云服务
腾讯云
微信公众号免费进行开发者中心云服务器配置
消息的接收与响应
那个学完这个小程序创业课程的小白现在月入17万
- 最新文章
-
Linux C语言连接MySQL 增删改查操作
MySQL C API by Example
The WebSocket API
android— javascript/HTML5/JS read/write local file
GCC 5.3发布,C的默认模式为-std=gnu11
(OK) Linux epoll模型—socket epoll server client chat—pthread
epoll pthread chat
myfastchat
epoll pthread—share the same epoll file descriptor among threads?
格式化 C/C++语言源码——命令indent