Set Methods (LINQ to Entities)

Most of the LINQ set methods are supported in LINQ to Entities queries, with the exception of those that use an EqualityComparer. For more information, see Standard Query Operators in LINQ to Entities Queries. The following table lists the supported and unsupported set methods.

Supported and Unsupported Operators

Method Support Visual Basic function signature C# method signature

All

Supported

Function All(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As Boolean
bool All<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

Any

Supported

Function Any(Of TSource) ( _
source As IQueryable(Of TSource) _
) As Boolean
bool Any<TSource>(
this IQueryable<TSource> source
)

Any

Supported

Function Any(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As Boolean
bool Any<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

Contains

Not supported

Function Contains(Of TSource) ( _
source As IQueryable(Of TSource), _
item As TSource _
) As Boolean
bool Contains<TSource>(
this IQueryable<TSource> source,
TSource item
)

Contains

Not supported

Function Contains(Of TSource) ( _
source As IQueryable(Of TSource), _
item As TSource, _
comparer As IEqualityComparer(Of TSource) _
) As Boolean
bool Contains<TSource>(
this IQueryable<TSource> source,
TSource item,
IEqualityComparer<TSource> comparer
)

Concat

Supported, but there is no guarantee of order being preserved

Function Concat(Of TSource) ( _
source1 As IQueryable(Of TSource), _
source2 As IEnumerable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Concat<TSource>(
this IQueryable<TSource> source1,
IEnumerable<TSource> source2
)

DefaultIfEmpty

Not supported

Function DefaultIfEmpty(Of TSource) ( _
source As IQueryable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> DefaultIfEmpty<TSource>(
this IQueryable<TSource> source
)

DefaultIfEmpty

Not supported

Function DefaultIfEmpty(Of TSource) ( _
source As IQueryable(Of TSource), _
defaultValue As TSource _
) As IQueryable(Of TSource)
IQueryable<TSource> DefaultIfEmpty<TSource>(
this IQueryable<TSource> source,
TSource defaultValue
)

Distinct

Supported

Function Distinct(Of TSource) ( _
source As IQueryable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Distinct<TSource>(
this IQueryable<TSource> source
)

Distinct

Not supported

Function Distinct(Of TSource) ( _
source As IQueryable(Of TSource), _
comparer As IEqualityComparer(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Distinct<TSource>(
this IQueryable<TSource> source,
IEqualityComparer<TSource> comparer
)

Except

Supported

Function Except(Of TSource) ( _
source1 As IQueryable(Of TSource), _
source2 As IEnumerable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Except<TSource>(
this IQueryable<TSource> source1,
IEnumerable<TSource> source2
)

Except

Not supported

Function Except(Of TSource) ( _
source1 As IQueryable(Of TSource), _
source2 As IEnumerable(Of TSource), _
comparer As IEqualityComparer(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Except<TSource>(
this IQueryable<TSource> source1,
IEnumerable<TSource> source2,
IEqualityComparer<TSource> comparer
)

Intersect

Supported

Function Intersect(Of TSource) ( _
source1 As IQueryable(Of TSource), _
source2 As IEnumerable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Intersect<TSource>(
this IQueryable<TSource> source1,
IEnumerable<TSource> source2
)

Intersect

Not supported

Function Intersect(Of TSource) ( _
source1 As IQueryable(Of TSource), _
source2 As IEnumerable(Of TSource), _
comparer As IEqualityComparer(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Intersect<TSource>(
this IQueryable<TSource> source1,
IEnumerable<TSource> source2,
IEqualityComparer<TSource> comparer
)

Union

Supported

Function Union(Of TSource) ( _
source1 As IQueryable(Of TSource), _
source2 As IEnumerable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Union<TSource>(
this IQueryable<TSource> source1,
IEnumerable<TSource> source2
)

Union

Not supported

Function Union(Of TSource) ( _
source1 As IQueryable(Of TSource), _
source2 As IEnumerable(Of TSource), _
comparer As IEqualityComparer(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Union<TSource>(
this IQueryable<TSource> source1,
IEnumerable<TSource> source2,
IEqualityComparer<TSource> comparer
)

See Also

Concepts

Supported and Unsupported Methods (LINQ to Entities)