[C#] Linq Object Sample
페이지 정보
작성자 sbLAB 댓글 0건 조회 4,614회 작성일 18-07-25 17:45본문
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
ex1();
}
public static void ex1()
{
string[] tools = { "Tablesaw", "Bandsaw", "Planer", "Jointer", "Drill", "Sander" };
int[] count = { 17, 22, 13, 4, 5, 9 };
//tools
var list_tools = from t in tools
where t.Contains("a")
orderby t descending
select t;
foreach (string s in list_tools)
{
Console.Write(s + "\n");
}
Console.Write("-------------------------\n");
//count
var list_count = from t in count
where t > 10
orderby t ascending
select t;
foreach (int c in list_count)
{
Console.Write(c + "\n");
}
}
}
}
댓글목록
등록된 댓글이 없습니다.