OptionExtensionsSomeIfT(Boolean, T) Method
Creates a result of
T as Some variant with value
value if the
someCondition holds.
Otherwise, it will return the None variant.
string team = "secret";
int score = 42;
Opt<string> winner = SomeIf(score > 30, team);
Assert(winner == Some(team));
Opt<string> loser = SomeIf(score < 40, team);
Assert(loser.IsNone);
Namespace: Orx.Fun.OptionAssembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
public static Opt<T> SomeIf<T>(
bool someCondition,
T value
)
- someCondition Boolean
- Condition that must hold for the return value to be Some(value).
- value T
- Underlying value of the Some variant to be returned if someCondition holds.
- T
[Missing <typeparam name="T"/> documentation for "M:Orx.Fun.Option.OptionExtensions.SomeIf``1(System.Boolean,``0)"]
OptT