DataServiceContext.EndExecute<TElement> Method

Called to complete the BeginExecute.

Namespace:  System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

public IEnumerable<TElement> EndExecute<TElement>(
	IAsyncResult asyncResult

Type Parameters


The type returned by the query.


Type: System.IAsyncResult
IAsyncResult object.

Return Value

Type: System.Collections.Generic.IEnumerable<TElement>
The response to the query operation.


When asyncResult is null.


When asyncResult did not originate from this instance or EndExecute<TElement> was previously called.


When an error occurs in the request or when materializing the results of a query into objects.

According to the standard begin-end asynchronous pattern, the provided callback is invoked when query results are retrieved.

When the callback is invoked, all results have been read from the HTTP stream, but they have not been processed; no local user-facing objects have been materialized or modified and identity resolution has not occurred. When EndExecute<TElement> is invoked, a DataServiceResponse is created and returned but the results still have not been processed. Identity resolution, object materialization, and manipulation occur only when the user enumerates the results.

You must use the BeginInvoke method of the Dispatcher class to correctly marshal the response operation back to the main application thread (the UI thread) of your Silverlight-based application. For more information, see Synchronizing Data for Multithreading.


Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions