Swiss Army Knife
General utility tools for Scada Minds
Static Public Member Functions | List of all members
NullableExtensions Class Reference

Extensions for inline-transformations of nullable values C# treats structs and classes differently in regards to how the nullable boxing is done, so there's an overload for both types. More...

Static Public Member Functions

static ? TRes TransformIfExists< T, TRes > (this T? nullable, Func< T, TRes > transformation)
 Takes a nullable struct, and if it is not-null, applies the given transformation to it. If it is null, the transformation function is not applied. More...
 
static ? TRes TransformIfExists< T, TRes > (this T? nullable, Func< T, TRes > transformation)
 Takes a nullable class, and if it is not-null, applies the given transformation to it. If it is null, the transformation function is not applied. More...
 

Detailed Description

Extensions for inline-transformations of nullable values C# treats structs and classes differently in regards to how the nullable boxing is done, so there's an overload for both types.

Member Function Documentation

◆ TransformIfExists< T, TRes >() [1/2]

static ? TRes TransformIfExists< T, TRes > ( this T?  nullable,
Func< T, TRes >  transformation 
)
inlinestatic

Takes a nullable struct, and if it is not-null, applies the given transformation to it. If it is null, the transformation function is not applied.

Type Constraints
T :struct 
TRes :struct 

◆ TransformIfExists< T, TRes >() [2/2]

static ? TRes TransformIfExists< T, TRes > ( this T?  nullable,
Func< T, TRes >  transformation 
)
inlinestatic

Takes a nullable class, and if it is not-null, applies the given transformation to it. If it is null, the transformation function is not applied.

Type Constraints
T :class 
TRes :class 

The documentation for this class was generated from the following file: