Class BindExtensions
- Namespace
- FunctionalDdd
- Assembly
- FunctionalDdd.RailwayOrientedProgramming.dll
Provides extension methods for binding (chaining) operations over Result values.
public static class BindExtensions
- Inheritance
-
BindExtensions
- Inherited Members
Remarks
Bind is the core operation in Railway Oriented Programming. It allows you to chain together operations that can fail, automatically short-circuiting on the first failure. If the input Result is a success, the bind function is called with the value. If the input Result is a failure, the bind function is skipped and the failure is propagated.
Methods
Bind<TValue, TResult>(Result<TValue>, Func<TValue, Result<TResult>>)
Binds the result to a function that returns a new result. If the starting result is a success, the function is called with the value. If the starting result is a failure, the function is skipped and the failure is returned.
public static Result<TResult> Bind<TValue, TResult>(this Result<TValue> result, Func<TValue, Result<TResult>> func)
Parameters
resultResult<TValue>The result to bind.
funcFunc<TValue, Result<TResult>>The function to call if the result is successful.
Returns
- Result<TResult>
A new result from the function if success; otherwise the original failure.
Type Parameters
TValueType of the input result value.
TResultType of the output result value.