zoukankan      html  css  js  c++  java
  • Linq三种查询

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    /*
     * 1、Linq查询结果有两种类型:一个是枚举,一个是标量(scalar)
     */
    namespace Linq三种查询
    {
        class Program
        {
            static void Main(string[] args)
            {
                int[] numbers = { 12,23,34,45,56,67,78,89};
                var numbersQuery = from n in numbers
                                   where n > 10
                                   select n;
                var numberMothod = numbers.Where(n =>n >10);
                int count = (from n in numbers where n > 10 
                             select n).Count();
                foreach (var x in numbersQuery)
                    Console.Write("{0} ",x);
                    Console.WriteLine();
                    foreach (var x in numberMothod)
                    Console.Write("{0} ", x);
                    Console.WriteLine();
                    Console.WriteLine(count);
                    Console.ReadKey();
            }
        }
    }
  • 相关阅读:
    抓包来看ftp状态码
    socket基础篇
    密码复杂度检查函数
    time模块
    读取日志文件,搜索关键字,打印关键字前5行。yield、deque实例
    装饰器--函数
    yield用法
    字符编码
    pycharm + git实现两台电脑代码同步
    PyCharm常见用法
  • 原文地址:https://www.cnblogs.com/sulong/p/4808007.html
Copyright © 2011-2022 走看看