Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

QueryableExtensions::LongCountAsync Method

Entity Framework 6.0
 

Asynchronously returns an Int64 that represents the total number of elements in a sequence.

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

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticLongCountAsync<TSource>(IQueryable<TSource>^)

Asynchronously returns an Int64 that represents the total number of elements in a sequence.

System_CAPS_pubmethodSystem_CAPS_staticLongCountAsync<TSource>(IQueryable<TSource>^, CancellationToken)

Asynchronously returns an Int64 that represents the total number of elements in a sequence.

System_CAPS_pubmethodSystem_CAPS_staticLongCountAsync<TSource>(IQueryable<TSource>^, Expression<Func<TSource, Boolean>^>^)

Asynchronously returns an Int64 that represents the number of elements in a sequence that satisfy a condition.

System_CAPS_pubmethodSystem_CAPS_staticLongCountAsync<TSource>(IQueryable<TSource>^, Expression<Func<TSource, Boolean>^>^, CancellationToken)

Asynchronously returns an Int64 that represents the number of elements in a sequence that satisfy a condition.

Return to top

QueryableExtensions::LongCountAsync<TSource> Method (IQueryable<TSource>^)

Asynchronously returns an Int64 that represents the total number of elements in a sequence.

public:
generic<typename TSource>
[ExtensionAttribute]
static Task<long long>^ LongCountAsync(
	IQueryable<TSource>^ source
)

Parameters

source
Type: System.Linq::IQueryable<TSource>^

An IQueryable<T> that contains the elements to be counted.

Return Value

Type: System.Threading.Tasks::Task<Int64>^

A task that represents the asynchronous operation. The task result contains the number of elements in the input sequence.

Type Parameters

TSource

The type of the elements of source.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

OverflowException

The number of elements in source is larger than MaxValue.

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.

Return to top

QueryableExtensions::LongCountAsync<TSource> Method (IQueryable<TSource>^, CancellationToken)

Asynchronously returns an Int64 that represents the total number of elements in a sequence.

public:
generic<typename TSource>
[ExtensionAttribute]
static Task<long long>^ LongCountAsync(
	IQueryable<TSource>^ source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq::IQueryable<TSource>^

An IQueryable<T> that contains the elements to be counted.

cancellationToken
Type: System.Threading::CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Return Value

Type: System.Threading.Tasks::Task<Int64>^

A task that represents the asynchronous operation. The task result contains the number of elements in the input sequence.

Type Parameters

TSource

The type of the elements of source.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

OverflowException

The number of elements in source is larger than MaxValue.

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.

Return to top

QueryableExtensions::LongCountAsync<TSource> Method (IQueryable<TSource>^, Expression<Func<TSource, Boolean>^>^)

Asynchronously returns an Int64 that represents the number of elements in a sequence that satisfy a condition.

public:
generic<typename TSource>
[ExtensionAttribute]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
static Task<long long>^ LongCountAsync(
	IQueryable<TSource>^ source,
	Expression<Func<TSource, bool>^>^ predicate
)

Parameters

source
Type: System.Linq::IQueryable<TSource>^

An IQueryable<T> that contains the elements to be counted.

predicate
Type: System.Linq.Expressions::Expression<Func<TSource, Boolean>^>^

A function to test each element for a condition.

Return Value

Type: System.Threading.Tasks::Task<Int64>^

A task that represents the asynchronous operation. The task result contains the number of elements in the sequence that satisfy the condition in the predicate function.

Type Parameters

TSource

The type of the elements of source.

Exception Condition
ArgumentNullException

source or predicate is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

OverflowException

The number of elements in source that satisfy the condition in the predicate function is larger than MaxValue.

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.

Return to top

QueryableExtensions::LongCountAsync<TSource> Method (IQueryable<TSource>^, Expression<Func<TSource, Boolean>^>^, CancellationToken)

Asynchronously returns an Int64 that represents the number of elements in a sequence that satisfy a condition.

public:
generic<typename TSource>
[ExtensionAttribute]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
static Task<long long>^ LongCountAsync(
	IQueryable<TSource>^ source,
	Expression<Func<TSource, bool>^>^ predicate,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq::IQueryable<TSource>^

An IQueryable<T> that contains the elements to be counted.

predicate
Type: System.Linq.Expressions::Expression<Func<TSource, Boolean>^>^

A function to test each element for a condition.

cancellationToken
Type: System.Threading::CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Return Value

Type: System.Threading.Tasks::Task<Int64>^

A task that represents the asynchronous operation. The task result contains the number of elements in the sequence that satisfy the condition in the predicate function.

Type Parameters

TSource

The type of the elements of source.

Exception Condition
ArgumentNullException

source or predicate is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

OverflowException

The number of elements in source that satisfy the condition in the predicate function is larger than MaxValue .

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.

Return to top
Show: