共用方式為


HOW TO:將序列轉換為陣列 (LINQ to SQL)

更新: November 2007

使用 ToArray<TSource> 可從序列建立陣列。

範例

下列範例使用 ToArray<TSource> 立即將查詢評估為陣列,並取得第三個項目。

Dim custQuery = _
    From cust In db.Customers _
    Where cust.City = "London" _
    Select cust
    Dim qArray() As Customer = custQuery.ToArray()
var custQuery =
    from cust in db.Customers
    where cust.City == "London"
    select cust;
    Customer[] qArray = custQuery.ToArray();

請參閱

其他資源

查詢範例 (LINQ to SQL)