Click or drag to resize

EntityObjectExtensionsIfNullThenT Method (T, FuncT)

Provides alternative to the ?? null-coalescing for domain objects. If the checked object is null or ghost, returns the result of defaultValueFunc.

Namespace:  Aloe.SystemFrameworks.Domain
Assembly:  Aloe.SystemFrameworks.Domain (in Aloe.SystemFrameworks.Domain.dll) Version: 20.1.3.5
Syntax
public static T IfNullThen<T>(
	this T checkedObject,
	Func<T> defaultValueFunc
)
where T : EntityObject

Parameters

checkedObject
Type: T
The object, which is tested for null or ghost.
defaultValueFunc
Type: SystemFuncT
The default value function.

Type Parameters

T
The type of the objects to check.

Return Value

Type: T
The checked object or if it is null or ghost - the defaultValueFunc result.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This overload is used for lazy load. The function is executed only if the checkedObject is null or ghost.
See Also