Skip to content

M_CodeJam_NullableHelper_GetValueOrDefault__1

Andrew Koryavchenko edited this page Jun 17, 2018 · 5 revisions

NullableHelper.GetValueOrDefault(T) Method

Retrieves the value of the current Nullable(T) object, or value returned by factory.

Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static T GetValueOrDefault<T>(
	Nullable<T> value,
	Func<T> defaultFactory
)
where T : struct, new()

VB

Public Shared Function GetValueOrDefault(Of T As {Structure, New}) ( 
	value As Nullable(Of T),
	defaultFactory As Func(Of T)
) As T

F#

static member GetValueOrDefault : 
        value : Nullable<'T> * 
        defaultFactory : Func<'T> -> 'T  when 'T : struct, new()

Parameters

 

value
Type: System.Nullable(T)
Nullable value.
defaultFactory
Type: System.Func(T)
A function to return default value if the HasValue property is false.

Type Parameters

 

T
The underlying value type of the Nullable(T) generic type.

Return Value

Type: T
The value of the Value property if the HasValue property is true; otherwise, the value returned by defaultFactory parameter.

See Also

Reference

NullableHelper Class
CodeJam Namespace

Clone this wiki locally