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; }
            }

        }
  • 相关阅读:
    day31-python之内置函数
    day30-python之socket
    day28-python之property
    day27-python之迭代器协议
    day26-python之封装
    day25-python之继承组合
    初识AJAX
    写博客的心得
    web前端常见面试题
    学习网络安全的网站
  • 原文地址:https://www.cnblogs.com/RuiLei/p/820473.html
Copyright © 2011-2022 走看看