共用方式為


DataServiceCollection<T> 建構函式 (IEnumerable<T>)

建立 DataServiceCollection<T> 類別的新執行個體,此執行個體基於查詢執行。

命名空間:  System.Data.Services.Client
組件:  Microsoft.Data.Services.Client (在 Microsoft.Data.Services.Client.dll 中)

語法

'宣告
Public Sub New ( _
    items As IEnumerable(Of T) _
)
'用途
Dim items As IEnumerable(Of T)

Dim instance As New DataServiceCollection(items)
public DataServiceCollection(
    IEnumerable<T> items
)
public:
DataServiceCollection(
    IEnumerable<T>^ items
)
new : 
        items:IEnumerable<'T> -> DataServiceCollection
public function DataServiceCollection(
    items : IEnumerable<T>
)

參數

備註

提供給 items 的物件 IEnumerable<T> 集合通常是傳回集合中之項目的查詢。 但是,也可以提供正確型別的任何 IEnumerable<T> 集合。

根據預設,DataServiceCollection<T> 已啟用自動變更追蹤。 當您使用建構函式提供 None 值給 TrackingMode 來建立執行個體時,您可以建立使用手動變更追蹤的 DataServiceCollection<T> 執行個體。 當您使用手動追蹤時,您必須實作 INotifyPropertyChangedINotifyCollectionChanged 並處理引發事件,向 DataServiceContext 手動回報變更。

請參閱

參考

DataServiceCollection<T> 類別

DataServiceCollection<T> 多載

System.Data.Services.Client 命名空間