ObjectQuery<T>::Intersect Method (ObjectQuery<T>^)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Limits the query results by including only the results that exist in another object query.

Namespace:   System.Data.Objects
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

ObjectQuery<T>^ Intersect(
	ObjectQuery<T>^ query


Type: System.Data.Objects::ObjectQuery<T>^

An ObjectQuery<T> that represents the results to include in the query.

Return Value

Type: System.Data.Objects::ObjectQuery<T>^

A new ObjectQuery<T> instance that is equivalent to the original instance with INTERSECT applied based on the specified query.

Exception Condition

The query parameter is null or is an empty string.

The supplied query that defines results to include must be of the same type or of a type that is compatible with the ObjectQuery<T>.

Parameters that are defined in the supplied query are merged with parameters that are defined in the ObjectQuery<T> instance. Parameters must be unique in the combined ObjectParameterCollection. There cannot be two parameters in the combined collection with the same name. For more information, see Query Builder Methods.

The resulting query inherits the connection from the ObjectQuery<T> instance on which the Intersect method was called.

The example in this topic is based on the AdventureWorks Sales Model. This example creates a new ObjectQuery<T> object that contains the results of two other queries.

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

.NET Framework
Available since 3.5
Return to top