zoukankan      html  css  js  c++  java
  • WPF List<T>.Sort示例

    WPF List<T>.Sort示例

    (2011-12-13 14:44:26)
    标签:

    杂谈

    分类: WPF

    public class EnumPair
    {
      public EnumPair(string text_english, string text_chinese, string value);
     
      public string Text_Chinese { get; set; }
      public string Text_English { get; set; }
      public string Value { get; set; }
    }
     
    List<EnumPair> affect = new List<EnumPair>();
    affect.Add(new EnumPair("1", "1", "1"));
    affect.Add(new EnumPair("3", "3", "3"));
    affect.Add(new EnumPair("5", "5", "5"));
    affect.Add(new EnumPair("8", "8", "8"));
    affect.Add(new EnumPair("24", "24", "24"));
    affect.Add(new EnumPair("2", "2", "2"));
    affect.Add(new EnumPair("11", "11", "11"));
    affect.Add(new EnumPair("14", "14", "14"));
     
    //把affect中的元素按照EnumPair.Value,以整型排序
    affect.Sort(delegate(EnumPair x, EnumPair y)
    {
      return Convert.ToInt32(x.Value).CompareTo(Convert.ToInt32(y.Value));
    });
    //把affect中的元素按照EnumPair.Value,以字符串排序
    affect.Sort(delegate(EnumPair x, EnumPair y)
    {
      return x.Value.CompareTo(y.Value);
    });
  • 相关阅读:
    oracle 更改账户名密码
    mongodb 分片副本集搭建
    爬虫目录
    centos MySQL安装与卸载
    ANACONDA 安装
    chrome 安装
    linux pycharm 安装 idea
    linux 基本命令
    高数18讲 之极限与连续
    高数18讲 之基础知识
  • 原文地址:https://www.cnblogs.com/LILING3/p/7610637.html
Copyright © 2011-2022 走看看