.Net 集合排序

List<MyBasicProtocol> adultProtocolList = new List<MyBasicProtocol>();

            adultProtocolList = new QhrServiceClient().GetAdultBasicProtocol();

            if (adultProtocolList != null)

            {

                adultProtocolList.Sort((MyBasicProtocol p1, MyBasicProtocol p2) =>

                    {

                        if (p2.Name.CompareTo(p1.Name) != 0)

                            return p1.Name.CompareTo(p2.Name);

                        else

                            return p2.Name.CompareTo(p1.Name);

 

                    });

            }

 

posted @ 2012-08-25 10:09  quietwalk  阅读(196)  评论(0编辑  收藏  举报