惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

博客园 - life++

multer /busboy 上传文件无法完成回调问题 linux系统上搭建egret构建环境(针对5.3.x 版以上) android studio 2.0 Gradle HttpProxy 设置 javascript的 parseInt 曾经的“陷井”在IE10上不见了,但还是得注意! 无法将类型为“xxxx”的对象强制转换为类型“Microsoft.SharePoint.WebPartPages.WebPart”。 ajax 12301 原因小结 被人忽悠完成的56.com我秀聊天室群发软件 WebDav基于Exchange2003开发邮件收发系统 fiddler 调试 WebDav 引起400错误处理 HTML-JS中的单双引混合处理原则 [笔记]443端口没开放让svn https连接不上 ora10ginstant 精简客户端遇到 system.data.oracleclient 需要 oracle 客户端软件8.1.7 或更高版本 手动调用__doPostBack('xx','') 在IE6, 下留意 javascript:void(0);问题。 让relative容器里的元素的z-index高于body下的遮照层 [原]SWFUpload 在IE9下不显示问题及IE9中模态窗下flash文件选择问题的处理 JQuery-easyui accordion 滚动条在IE6下“丢失”的处理 asp.net Ajax 页中使用jquery-easyui的显示问题处理 equal 与 == 自问自答
胡乱写个 List string 类型排序。
life++ · 2010-11-24 · via 博客园 - life++

不得不也写了个排序。 先用着。有空再改进。

structs.Sort(new Comparison<Model.TableStruct>((t1, t2) => 
            {
                var i = 0;
                var n1 = t1.ColName.ToLower();
                var n2 = t2.ColName.ToLower();

                while (n1.Length > i + 1 && n2.Length > i + 1 && n1[i] == n2[i])
                {
                    i++;
                }

                if (n1[i] > n2[i])
                    return 1;
                if (n1[i] < n2[i])
                    return -1;                
                if (n1.Length < n2.Length)
                    return -1;
                if (n1.Length > n2.Length)
                    return 1;

                return 0;
            }));
 public int CompareTo(object obj)
        {
            if (obj is TableStruct)
            {
                var t1 = this;
                var t2 = (TableStruct)obj;

                var i = 0;
                var n1 = t1.ColName.ToLower();
                var n2 = t2.ColName.ToLower();

                while (n1.Length > i + 1 && n2.Length > i + 1 && n1[i] == n2[i])
                {
                    i++;
                }

                if (n1[i] > n2[i])
                    return 1;
                if (n1[i] < n2[i])
                    return -1;
                if (n1.Length < n2.Length)
                    return -1;
                if (n1.Length > n2.Length)
                    return 1;

                return 0;
            }
            else
            {
                throw new Exception("不能比较");
            }
        }

posted @ 2010-11-24 23:45  life++  阅读(1234)  评论()    收藏  举报