Export (0) Print
Expand All

DataTableExtensions::AsDataView<T> Method (EnumerableRowCollection<T>)

Creates and returns a LINQ-enabled DataView object representing the LINQ to DataSet query.

Namespace:  System.Data
Assembly:  System.Data.DataSetExtensions (in System.Data.DataSetExtensions.dll)

[ExtensionAttribute]
public:
generic<typename T>
where T : DataRow 
static DataView^ AsDataView(
	EnumerableRowCollection<T>^ source
)

Type Parameters

T

The type of objects in the source sequence, typically DataRow.

Parameters

source
Type: System.Data::EnumerableRowCollection<T>

The source LINQ to DataSet query from which the LINQ-enabled DataView is created.

Return Value

Type: System.Data::DataView
A LINQ-enabled DataView object.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type EnumerableRowCollection<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

DataView enables data binding scenarios for LINQ to DataSet and can be created from a LINQ to DataSet query. The DataView represents the query itself, and is not a view on top of the query. The newly created DataView infers the filtering and sorting information from the query it is created from. The DataView is then bound to a UI control, such as a DataGrid or a DataGridView, providing a simple data-binding model.

The parameter T of the input parameter source can only be of type DataRow or a type derived from DataRow.

The following query operators, only, are supported in a query used to create DataView:

For more information and examples, see Creating a DataView Object (LINQ to DataSet).

The following example creates a DataView of online orders ordered by total due:

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft