EntityFrameworkQueryableExtensions.ContainsAsync<TSource> Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Asynchronously determines whether a sequence contains a specified element by using the default equality comparer.
public static System.Threading.Tasks.Task<bool> ContainsAsync<TSource> (this System.Linq.IQueryable<TSource> source, TSource item, System.Threading.CancellationToken cancellationToken = default);
static member ContainsAsync : System.Linq.IQueryable<'Source> * 'Source * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
<Extension()>
Public Function ContainsAsync(Of TSource) (source As IQueryable(Of TSource), item As TSource, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)
- TSource
The type of the elements of source
.
- source
- IQueryable<TSource>
An IQueryable<T> to return the single element of.
- item
- TSource
The object to locate in the sequence.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
A task that represents the asynchronous operation.
The task result contains true
if the input sequence contains the specified value; otherwise,
false
.
source
is null
.
If the CancellationToken is canceled.
Multiple active operations on the same context instance are not supported. Use await
to ensure that any asynchronous operations have completed before calling another method on this context. See Avoiding DbContext threading issues for more information and examples.
See Querying data with EF Core for more information and examples.
Product | Versions |
---|---|
efcore-9.0 | efcore-9.0 |
Entity Framework feedback
Entity Framework is an open source project. Select a link to provide feedback: