Show / Hide Table of Contents

Class NumericOption

This class contains static methods for creation an Option<T>.

Inheritance
object
NumericOption
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: RustyOptions
Assembly: RustyOptions.dll
Syntax
public static class NumericOption

Methods

| Edit this page View Source

Create<T>(T?)

Returns a Some option for the specified value is it is not null, otherwise None.

Declaration
public static NumericOption<T> Create<T>(T? value) where T : struct, INumber<T>
Parameters
Type Name Description
T? value

The value to wrap in a Some option.

Returns
Type Description
NumericOption<T>

The given value, wrapped in a Some option.

Type Parameters
Name Description
T
| Edit this page View Source

None<T>()

Returns the None option for the specified T.

Declaration
public static NumericOption<T> None<T>() where T : struct, INumber<T>
Returns
Type Description
NumericOption<T>
Type Parameters
Name Description
T
| Edit this page View Source

Parse<T>(ReadOnlySpan<char>)

Parses a char span into any type that supports ISpanParsable<TSelf>.

Declaration
public static NumericOption<T> Parse<T>(ReadOnlySpan<char> s) where T : struct, ISpanParsable<T>, INumber<T>
Parameters
Type Name Description
ReadOnlySpan<char> s

The char span to parse.

Returns
Type Description
NumericOption<T>

The parsed value wrapped in a Some option, or else None.

Type Parameters
Name Description
T

The type to parse the char span into.

| Edit this page View Source

Parse<T>(ReadOnlySpan<char>, IFormatProvider?)

Parses a char span into any type that supports ISpanParsable<TSelf>.

Declaration
public static NumericOption<T> Parse<T>(ReadOnlySpan<char> s, IFormatProvider? provider) where T : struct, ISpanParsable<T>, INumber<T>
Parameters
Type Name Description
ReadOnlySpan<char> s

The char span to parse.

IFormatProvider provider

An optional format provider.

Returns
Type Description
NumericOption<T>

The parsed value wrapped in a Some option, or else None.

Type Parameters
Name Description
T

The type to parse the char span into.

| Edit this page View Source

Parse<T>(string)

Parses a string into any type that supports IParsable<TSelf>.

Declaration
public static NumericOption<T> Parse<T>(string s) where T : struct, IParsable<T>, INumber<T>
Parameters
Type Name Description
string s

The string to parse.

Returns
Type Description
NumericOption<T>

The parsed value wrapped in a Some option, or else None.

Type Parameters
Name Description
T

The type to parse the string into.

| Edit this page View Source

Parse<T>(string, IFormatProvider?)

Parses a string into any type that supports IParsable<TSelf>.

Declaration
public static NumericOption<T> Parse<T>(string s, IFormatProvider? provider) where T : struct, IParsable<T>, INumber<T>
Parameters
Type Name Description
string s

The string to parse.

IFormatProvider provider

An optional format provider.

Returns
Type Description
NumericOption<T>

The parsed value wrapped in a Some option, or else None.

Type Parameters
Name Description
T

The type to parse the string into.

| Edit this page View Source

Some<T>(T)

Returns a Some option for the specified value.

Declaration
public static NumericOption<T> Some<T>(T value) where T : struct, INumber<T>
Parameters
Type Name Description
T value

The value to wrap in a Some option.

Returns
Type Description
NumericOption<T>

The given value, wrapped in a Some option.

Type Parameters
Name Description
T
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX