• Linq操作list



    https://www.cnblogs.com/dullfish/p/6101912.html
    List<string> existCode = new List<string> { "27101210", "27101220", "27101230", "27101911", "27101921", "27101922", "27101929", "27101991", "27101992", "27101993", "27101999" }; List<string> getCode = new List<string> { "27101210", "27101220" }; var exp1 = existCode.Where(n => getCode.Exists(t => n.Contains(t))).ToList();//查询的list存在固定组里的值 俩个list比较
    linq基础查询
    var query = from r in p where r.Age == "20" orderby r.Age descending select r;

    foreach (Person st in query)
    {
    Console.WriteLine("***************");
    Console.WriteLine("姓名:" + st.Name);
    Console.WriteLine("班级:" + st.Sex);
    Console.WriteLine("年龄:" + st.Age);
    }

    
    
    
    • 联合查询-join

    //查询出集合qSt中year等于集合qSc中year的元素并形成新的集合
    var qjoin = from r in qSt
    join c in qSc
    on r.year equals c.year
    select new
    {
    Year = r.year,
    stName = r.name,
    scName = c.name
    };

     
  • 相关阅读:
    循环链表问题
    非常有用的编程学习网站
    我的单例模式(C++)
    C# xml解析
    设计模式趣解
    简单工厂(C++)
    贝塞尔曲线 原理
    C++ 1.#QNAN0;1.#QNAN0
    [NOI2018]屠龙勇士 excrt
    [NOI.AC#30]candy 贪心
  • 原文地址:https://www.cnblogs.com/lacey/p/14954163.html
Copyright © 2020-2023  润新知