【Orcas】 Visual Studio 2007 【.NET3.0】 Part3 at TECH
[2ch|▼Menu]
812:デフォルトの名無しさん
07/12/23 15:57:45
LINQ: .NET 統合言語クエリ
URLリンク(www.microsoft.com)

標準クエリ演算子の概要
LINQ の作用を調べるために、配列の内容の処理に標準クエリ演算子を使用する簡単な C# 3.0 プログラムから見ていくことにしましょう。

using System;
using System.Linq;
using System.Collections.Generic;

class app {
static void Main() {
string[] names = { "Burke", "Connor", "Frank",
"Everett", "Albert", "George",
"Harris", "David" };

IEnumerable<string> query = from s in names
where s.Length == 5
orderby s
select s.ToUpper();

foreach (string item in query)
Console.WriteLine(item);
}
}
このプログラムをコンパイルして実行すると、次のような出力が得られます。

BURKE
DAVID
FRANK




次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

5396日前に更新/177 KB
担当:undef