From Method
Definition
- Namespace
- Tyne
- Assembly
- Tyne.Core.dll
Methods
| Edit this page View SourceFrom<T>(T?)
Creates an Option<T> from value
.
Declaration
[Pure]
public static Option<T> From<T>(T? value)
Parameters
value
- T
The T
to wrap.
Returns
Option<T>A <code>Some(<code class="typeparamref">T</code>)</code> <xref href="Tyne.Option%601" data-throw-if-not-resolved="false"></xref> if <code class="paramref">value</code> is not <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a>;
otherwise, a None
Option<T>.
Type Parameters
T
The type of value the option encapsulates.
Remarks
Bear in mind that value-typed T
s will always return Some(
as T
)T
cannot be null.