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
类型:System.Collections.Generic.IEnumerable<T>
DataServiceQuery<TElement> 或 LINQ 查询,可返回用于初始化集合的对象的 IEnumerable<T> 集合。
注释
为 items 提供的对象的 IEnumerable<T> 集合通常是可一个返回集合中各项的查询。 不过,可以提供正确类型的任何 IEnumerable<T> 集合。
默认情况下,将对 DataServiceCollection<T> 启用自动更改跟踪。 您可以创建 DataServiceCollection<T> 的实例,该实例在您使用可以为 TrackingMode 提供 None 值的构造函数创建实例时,会使用手动更改跟踪。 使用手动跟踪时,必须实现 INotifyPropertyChanged 和 INotifyCollectionChanged 并处理引发事件,以便将更改手动报告到 DataServiceContext。