C# linq 的from where select用法举例

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

namespace LINQtest
{
class Program
{
static void Main(string[] args)
{
string[] mm = new string[] { “2”, “4” ,“2312”, “34” };

             var tt = from n in mm
                  where n.Length > 1
                  select n;

        var reesult = mm.AsEnumerable().Where(j => j.Length <2).ToList();
        foreach( var i in tt )
        {
            Console.WriteLine(i);
        }
        foreach (var j in reesult)
        {
            Console.WriteLine(j);
        }
        Console.ReadKey();

    }
}

}

C# linq 的from where select用法举例_第1张图片

你可能感兴趣的:(C#,LINQ)