zoukankan      html  css  js  c++  java
  • linq lamada

       static void Main(string[] args)
            {
                List<Customer> cust = new List<Customer>() { 
                        new Customer{first="11",last="a1",ID="1",City="chian"},
                        new Customer{first="22",last="a2",ID="2",City="guangzhou"},
                        new Customer{first="33",last="a3",ID="3",City="beijing"},
                        new Customer{first="44",last="a4",ID="4",City="shanghai"}
                };
                //linq写法
                //IEnumerable<Customer> cus = from cu in cust where cu.City == "beijing" select cu;
                //lamada写法
                IEnumerable<Customer> cus = cust.Where(p => p.City == "beijing").Select(p => p);
                foreach (Customer item in cus)
                {
                    Console.WriteLine(item.first + "," + item.last);
                }
                Console.ReadKey();
            }
        }
        class Customer
        {
            public string first { get; set; }
            public string last { get; set; }
            public string ID { get; set; }
            public string City { get; set; }
        }
  • 相关阅读:
    Hook技术
    进程间的调试关系
    常见的2种断点方法
    CrackMe的简单破解
    PE文件结构
    DLL卸载
    DLL注入
    调用DLL的2种方式
    iOS密码输入框的实现
    UITableView.separatorInset
  • 原文地址:https://www.cnblogs.com/melonlee/p/3270283.html
Copyright © 2011-2022 走看看