從具有簡單條件的陣列中選擇

Dim sites() As String = {"Stack Overflow", "Super User", "Ask Ubuntu", "Hardware   Recommendations"}
Dim query = From x In sites Where x.StartsWith("S")
' result = "Stack Overflow", "Super User"

查詢將是包含 Stack OverflowSuper User 的可列舉物件。查詢中的 x 是迭代變數,其中將儲存 Where 子句檢查的每個物件。