zoukankan      html  css  js  c++  java
  • Linq to 泛型集合查询集合包括大写M和年龄小于等于18

          #region Linq to 泛型集合查询集合包括大写M和年龄小于等于18
                //List<Student> list = new List<Student>();
                //list.Add(new Student { Name = "Tom", Age = 17 });
                //list.Add(new Student { Name = "Jerry", Age = 16 });
                //list.Add(new Student { Name = "Marry", Age = 18 });
                //list.Add(new Student { Name = "Monika", Age = 22 });
                //list.Add(new Student { Name = "Frank", Age = 20 });
                //list.Add(new Student { Name = "Alex", Age = 15 });

                ////在讲解中,可以演示除了Contains之外的其他常用方法
                //var result = from s in list
                //             where s.Name.Contains("M") && s.Age >= 18
                //             select s;

                //foreach (var stu in result)
                //{
                //    Console.WriteLine("姓名:{0},年龄:{1}", stu.Name, stu.Age.ToString());
                //}

                #endregion

  • 相关阅读:
    对学生排序 Exercise07_17
    消除重复 Exercise07_15
    计算gcd Exercise07_14
    随机数选择器 Exercise07_13
    dom4j 学习总结
    jQuery学习总结(二)
    jQuery学习总结(一)
    SQL中Where与Having的区别
    html + css (1)
    struts2+json
  • 原文地址:https://www.cnblogs.com/914556495wxkj/p/4366610.html
Copyright © 2011-2022 走看看