码迷,mamicode.com
首页 > 其他好文 > 详细

Linq

时间:2017-04-22 12:40:26      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:generic   ica   技术分享   while   src   reading   tor   class   obj   

技术分享
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Collections;
using System.Threading.Tasks;
namespace test
{
  public class teste {
      
      static void Main()
      {
          string[] contries = new string[] { "china", "russia", "american", "spain", "japan", "china" };
         // var query = from a in contries select a;//Linq to object  
          var query = from c in contries.Distinct() 
                      where c.Length == 5 
                      orderby c //按大小进行排序
                      ascending select c; 
          IEnumerator enumerator = query.GetEnumerator();
          while (enumerator.MoveNext())
          {
              Console.WriteLine(enumerator.Current);
          }  
          Console.ReadKey();
      }
   }
  }
View Code

 

Linq

标签:generic   ica   技术分享   while   src   reading   tor   class   obj   

原文地址:http://www.cnblogs.com/syzly/p/6746927.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!