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();
            }
        }
    }
  • 相关阅读:
    12
    11
    10
    9
    8
    6. iOS APP 设计规范大全
    4. iOS中常用演示方法以及利弊
    我要写一篇动态计算tableView-cell高度的随笔
    doclever 5.5.1 安装及升级【原创】
    SPARROW-JS 从0开始写 0依赖,原生JS框架
  • 原文地址:https://www.cnblogs.com/sulong/p/4808007.html
Copyright © 2011-2022 走看看