ResultExtensionsOkIfT(Boolean, T, String) Method
Creates a result of
T as Ok variant with value
value if the
okCondition holds.
Otherwise, it will map into an Err.
Shape shape = GetShape(); // valid only if shape has a positive base area.
Res<Shape> resultShape = OkIf(shape.GetBaseArea() > 0, shape);
Namespace: Orx.Fun.ResultAssembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
public static Res<T> OkIf<T>(
bool okCondition,
T value,
string strOkCondition = ""
)
- okCondition Boolean
- Condition that must hold for the return value to be Ok(value).
- value T
- Underlying value of the Ok variant to be returned if okCondition holds.
- strOkCondition String (Optional)
- Name of the condition; to be appended to the error message if it does not hold. Omitting the argument will automatically be filled with the condition's expression in the caller side.
- T
[Missing <typeparam name="T"/> documentation for "M:Orx.Fun.Result.ResultExtensions.OkIf``1(System.Boolean,``0,System.String)"]
ResT