Table of Contents

Method Upcast

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

Upcast<T>(T)

Gives the value as the given type. This names the target type, where type inference gives the type of the value.

public static T Upcast<T>(this T o)

Parameters

o T

The value.

Returns

T

The same value, typed as T.

Type Parameters

T

The type to view the value as.

Remarks

This changes nothing. It only changes the static type. Used here to get to an explicit interface implementation - this.Upcast<IMaybe>() - without a cast expression and the parentheses that come with it.