【VB】LINQ ~ Where編 ~

サンプル

'データ配列
Dim values As New List(Of Company) From
{
    New Company With {.Id = "X001", .CountryCode = "JP", .Type = "Car", .Name = "Toyota", .Point = 34},
    New Company With {.Id = "X002", .CountryCode = "JP", .Type = "Etc", .Name = "Hitachi", .Point = 33},
    New Company With {.Id = "Y001", .CountryCode = "US", .Type = "IT", .Name = "Google", .Point = 49},
    New Company With {.Id = "Y002", .CountryCode = "US", .Type = "IT", .Name = "Yahoo", .Point = 38},
    New Company With {.Id = "X003", .CountryCode = "JP", .Type = "Etc", .Name = "Mitsubishi", .Point = 29},
    New Company With {.Id = "X004", .CountryCode = "JP", .Type = "Etc", .Name = "Toshiba", .Point = 17},
    New Company With {.Id = "X005", .CountryCode = "US", .Type = "Etc", .Name = "Motorola", .Point = 34},
    New Company With {.Id = "Z001", .CountryCode = "EU", .Type = "IT", .Name = "SAP", .Point = 40},
    New Company With {.Id = "X006", .CountryCode = "US", .Type = "IT", .Name = "Microsoft", .Point = 45},
    New Company With {.Id = "Z002", .CountryCode = "EU", .Type = "IT", .Name = "Nokia", .Point = 24}
}

Dim companies = values.Where(Function(x) x.Id = "Y001")

For Each companyValue In companies
    Debug.WriteLine("{0} {1}", companyValue.CountryCode, companyValue.Name)
Next

出力結果

US Google