VB.NET
' 動物配列作成
Dim STR_ANIMALS As String() = {"dog", "cat", "pig", "rabbit"}
' 動物を全て取得
Dim query = From animals In STR_ANIMALS
' queryの配列から名称を取り出す
For Each animal As String In query
Debug.WriteLine(animal)
Next
C#
// 動物配列作成
string[] STR_ANIMALS = {
"dog",
"cat",
"pig",
"rabbit"
};
// 動物を全て取得
dynamic query = from animals in STR_ANIMALS select animals;
// queryの配列から名称を取り出す
foreach (string animal in query)
{
Console.WriteLine(animal);
}