QueryableExtensions.SumAsync 方法 (IQueryable<Nullable<Double>>)

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

异步计算可为 null 的 Double 值序列的总和。

命名空间:  System.Data.Entity
程序集:  EntityFramework(在 EntityFramework.dll 中)

语法

声明
<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")> _
<ExtensionAttribute> _
Public Shared Function SumAsync ( _
    source As IQueryable(Of Nullable(Of Double)) _
) As Task(Of Nullable(Of Double))
用法
Dim source As IQueryable(Of Nullable(Of Double))
Dim returnValue As Task(Of Nullable(Of Double))

returnValue = source.SumAsync()
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> SumAsync(
    this IQueryable<Nullable<double>> source
)
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1006:DoNotNestGenericTypesInMemberSignatures")]
[ExtensionAttribute]
public:
static Task<Nullable<double>>^ SumAsync(
    IQueryable<Nullable<double>>^ source
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
static member SumAsync : 
        source:IQueryable<Nullable<float>> -> Task<Nullable<float>> 
public static function SumAsync(
    source : IQueryable<Nullable<double>>
) : Task<Nullable<double>>

参数

返回值

类型:System.Threading.Tasks.Task<Nullable<Double>>
表示异步操作的任务。任务结果包含序列中值的总和。

使用说明

在 Visual Basic 和 C# 中,可以在 IQueryable<Nullable<Double>> 类型的任何对象上将此方法作为实例方法来调用。当使用实例方法语法调用此方法时,请省略第一个参数。有关详细信息,请参阅https://msdn.microsoft.com/zh-cn/library/bb384936(v=vs.113)https://msdn.microsoft.com/zh-cn/library/bb383977(v=vs.113)

异常

例外 条件
ArgumentNullException

source 为 null。

InvalidOperationException

source 不实现 IDbAsyncQueryProvider

备注

不支持对同一上下文实例执行多个活动操作。 使用“await”以确保在对此上下文调用另一个方法前完成了所有异步操作。

请参阅

参考

QueryableExtensions 类

SumAsync 重载

System.Data.Entity 命名空间