zoukankan      html  css  js  c++  java
  • Linq 入门系列 [Group,Distinct,Union,Concat,Intersect,Except篇]

     ////////////////////////////
        
    ///以下是Group,Distinct,Union,Concat,Intersect,Except的例子和解释
        
    /////////////////////////////

        class Program
        
    {
            
    DB

            
    static void Main(string[] args)
            
    {
                List
    <Student> studentList = GetStudents();

                
    //Group(studentList);

                
    //Distinct(studentList);

                
    //Union(studentList);

                
    //Concat(studentList);

                Intersect(studentList);

                
    //Except();
            }


            
    Group,Distinct,Union,Concat,Intersect,Except

            
    private static IEnumerable<Student> RevealChangeType<T>(T obj)
            
    {
                IEnumerable
    <Student> student = obj as IEnumerable<Student>;

                
    return student;
            }

        }


        
    sealed class Student
        
    {
            
    public int age;
            
    public int Age
            
    {
                
    get return age; }
                
    set { age = value; }
            }


            
    private string name;
            
    public string Name
            
    {
                
    get return name; }
                
    set { name = value; }
            }


            
    private string language;
            
    public string Language
            
    {
                
    get return language; }
                
    set { language = value; }
            }

        }
  • 相关阅读:
    洛谷P2912 [USACO08OCT]牧场散步Pasture Walking [2017年7月计划 树上问题 01]
    洛谷P1082 同余方程 [2012NOIP提高组D2T1] [2017年6月计划 数论06]
    洛谷P2667 超级质数 [2017年6月计划 数论05]
    洛谷P1965 转圈游戏 [2013NOIP提高组 D1T1][2017年6月计划 数论04]
    洛谷P1595 信封问题
    洛谷P1062 数列 [2017年6月计划 数论03]
    洛谷P2835 刻录光盘 [2017年6月计划 强连通分量02]
    洛谷P2826 [USACO08NOV]光开关Light Switching [2017年6月计划 线段树02]
    【模板】矩阵快速幂 洛谷P2233 [HNOI2002]公交车路线
    【模板】ST表 洛谷P1816 忠诚
  • 原文地址:https://www.cnblogs.com/RuiLei/p/820473.html
Copyright © 2011-2022 走看看