zoukankan      html  css  js  c++  java
  • c# list exists(contains) delegate 委托判断 元素是否在LIST中存在

    static void Main(string[] args)
            {
                List<GoodsInfo> list = new List<GoodsInfo>();
                GoodsInfo g1 = new GoodsInfo();
                g1.GoodsPriceRangeName = "200~399";
                list.Add(g1);
                GoodsInfo g2 = new GoodsInfo();
                g1.GoodsPriceRangeName = "0~99";
                list.Add(g2);
                GoodsInfo g3 = new GoodsInfo();
                g3.GoodsPriceRangeName = "200-399";
                list.Add(g3);
                UltBLL ultBll = new UltBLL();
                List<Tbl_Dictionary> dictList = ultBll.GetDictInfoByDictType("GoodsPriceRange", false);
                
                foreach (GoodsInfo info in list)
                {
                    if (dictList.Exists(dict => dict.DictName.Equals(info.GoodsPriceRangeName)))
                    {
                        Console.Write("exists");
                    }
                }
                
                Console.WriteLine("ok");
                Console.Read();
            }

  • 相关阅读:
    一个给照片换底色的牛逼网站
    如何写好ppt
    当你迷茫时,就来看看这个视频!
    IPV6地址检测
    性能测试流程
    pycharm中无法以pytest运行
    Mac charles配置完成后无法上网
    Mac Mysql安装过程的各种坑
    python常用模块之——正则re模块
    Jmeter参数化真香
  • 原文地址:https://www.cnblogs.com/niaowo/p/3751524.html
Copyright © 2011-2022 走看看