Table of contents
Collapse the table of content
Expand the table of content

QueryBuilder.AverageByNullable<'T,'Q,^Value> Method (F#)

Den Delimarsky|Last Updated: 8/18/2017
1 Contributor

A query operator that selects a nullable value for each element selected so far and returns the average of these values. If any nullable does not have a value, it is ignored.

Namespace/Module Path: Microsoft.FSharp.Linq

Assembly: FSharp.Core (in FSharp.Core.dll)


// Signature:
member this.AverageByNullable : QuerySource<'T,'Q> * ('T -> Nullable<^Value>) -> Nullable<^Value> when ^Value with static member (+) and ^Value with static member DivideByInt and ^Value with static member Zero and ^Value : (new : unit ->  ^Value) and ^Value : struct and ^Value :> ValueType

// Usage:
queryBuilder.AverageByNullable (source, projection)


source Type: QuerySource<'T,'Q>

The input query.

projection Type: 'T -> System.Nullable`1<^Value>

A function that computes a value for each element.

Return Value

The average value.


Null values do not affect the average.

For more information and examples, see Query Expressions (F#).


Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 4.0, Portable

See Also

Linq.QueryBuilder Class (F#)

Microsoft.FSharp.Linq Namespace (F#)

Query Expressions (F#)

© 2020 Microsoft