Show / Hide Table of Contents

Struct NumericOption<T>

NumericOption<T> represents an optional number: every NumericOption<T> is either Some and contains a number, or None, and does not.

Implements
INumber<NumericOption<T>>
IComparable
IComparable<NumericOption<T>>
IComparisonOperators<NumericOption<T>, NumericOption<T>, bool>
IModulusOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>
INumberBase<NumericOption<T>>
IEquatable<NumericOption<T>>
ISpanParsable<NumericOption<T>>
IParsable<NumericOption<T>>
IAdditionOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>
IAdditiveIdentity<NumericOption<T>, NumericOption<T>>
IDecrementOperators<NumericOption<T>>
IDivisionOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>
IEqualityOperators<NumericOption<T>, NumericOption<T>, bool>
IIncrementOperators<NumericOption<T>>
IMultiplicativeIdentity<NumericOption<T>, NumericOption<T>>
IMultiplyOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>
ISubtractionOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>
IUnaryNegationOperators<NumericOption<T>, NumericOption<T>>
IUnaryPlusOperators<NumericOption<T>, NumericOption<T>>
ISpanFormattable
IFormattable
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: RustyOptions
Assembly: RustyOptions.dll
Syntax
[Serializable]
[JsonConverter(typeof(NumericOptionJsonConverter))]
public readonly struct NumericOption<T> : INumber<NumericOption<T>>, IComparable, IComparable<NumericOption<T>>, IComparisonOperators<NumericOption<T>, NumericOption<T>, bool>, IModulusOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>, INumberBase<NumericOption<T>>, IEquatable<NumericOption<T>>, ISpanParsable<NumericOption<T>>, IParsable<NumericOption<T>>, IAdditionOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>, IAdditiveIdentity<NumericOption<T>, NumericOption<T>>, IDecrementOperators<NumericOption<T>>, IDivisionOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>, IEqualityOperators<NumericOption<T>, NumericOption<T>, bool>, IIncrementOperators<NumericOption<T>>, IMultiplicativeIdentity<NumericOption<T>, NumericOption<T>>, IMultiplyOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>, ISubtractionOperators<NumericOption<T>, NumericOption<T>, NumericOption<T>>, IUnaryNegationOperators<NumericOption<T>, NumericOption<T>>, IUnaryPlusOperators<NumericOption<T>, NumericOption<T>>, ISpanFormattable, IFormattable where T : struct, INumber<T>
Type Parameters
Name Description
T

The type the option might contain.

Constructors

| Edit this page View Source

NumericOption(T)

Creates an Option<T> containing the given value.

NOTE: Nulls are not allowed; a null value will result in a None option.

Declaration
public NumericOption(T value)
Parameters
Type Name Description
T value

The value to wrap in an Option<T>.

Properties

| Edit this page View Source

IsNone

Returns true if the option is None.

Declaration
public bool IsNone { get; }
Property Value
Type Description
bool
| Edit this page View Source

None

Returns the None option for the specified T.

Declaration
public static NumericOption<T> None { get; }
Property Value
Type Description
NumericOption<T>
| Edit this page View Source

One

Gets the value 1 for the type.

Declaration
public static NumericOption<T> One { get; }
Property Value
Type Description
NumericOption<T>
| Edit this page View Source

Zero

Gets the value 0 for the type.

Declaration
public static NumericOption<T> Zero { get; }
Property Value
Type Description
NumericOption<T>

Methods

| Edit this page View Source

Abs(NumericOption<T>)

Computes the absolute of a value.

Declaration
public static NumericOption<T> Abs(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value for which to get its absolute.

Returns
Type Description
NumericOption<T>

The absolute of value.

Exceptions
Type Condition
OverflowException

The absolute of value is not representable by NumericOption<T>.

| Edit this page View Source

AsEnumerable()

Returns an IEnumerable<T> containing either zero or one value, depending on whether the option is None or Some.

Declaration
public IEnumerable<T> AsEnumerable()
Returns
Type Description
IEnumerable<T>

An enumerable containing the option's value, or an empty enumerable.

| Edit this page View Source

AsSpan()

Converts the option into a ReadOnlySpan<T> that contains either zero or one items depending on whether the option is None or Some.

Declaration
public ReadOnlySpan<T> AsSpan()
Returns
Type Description
ReadOnlySpan<T>

A span containing the option's value, or an empty span.

| Edit this page View Source

Clamp(NumericOption<T>, NumericOption<T>, NumericOption<T>)

Clamps a value to an inclusive minimum and maximum value.

Declaration
public static NumericOption<T> Clamp(NumericOption<T> value, NumericOption<T> min, NumericOption<T> max)
Parameters
Type Name Description
NumericOption<T> value

The value to clamp.

NumericOption<T> min

The inclusive minimum to which value should clamp.

NumericOption<T> max

The inclusive maximum to which value should clamp.

Returns
Type Description
NumericOption<T>

The result of clamping value to the inclusive range of min and max.

Exceptions
Type Condition
ArgumentException

min is greater than max.

| Edit this page View Source

CompareTo(NumericOption<T>)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Some compares as less than any None, while two Some compare as their contained values would in T.

Declaration
public int CompareTo(NumericOption<T> other)
Parameters
Type Name Description
NumericOption<T> other
Returns
Type Description
int

-1 if this instance precendes other, 0 if they are equal, and 1 if this instance follows other.

| Edit this page View Source

CompareTo(object?)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Declaration
public int CompareTo(object? obj)
Parameters
Type Name Description
object obj

An object to compare with this instance.

Returns
Type Description
int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes obj in the sort order.
Zero This instance occurs in the same position in the sort order as obj.
Greater than zero This instance follows obj in the sort order.
Exceptions
Type Condition
ArgumentException

obj is not the same type as this instance.

| Edit this page View Source

CreateChecked<TOther>(TOther)

Creates an instance of the current type from a value, throwing an overflow exception for any values that fall outside the representable range of the current type.

Declaration
public static NumericOption<T> CreateChecked<TOther>(TOther value) where TOther : INumberBase<TOther>
Parameters
Type Name Description
TOther value

The value that's used to create the instance of NumericOption<T>.

Returns
Type Description
NumericOption<T>

An instance of NumericOption<T> created from value.

Type Parameters
Name Description
TOther

The type of value.

Exceptions
Type Condition
NotSupportedException

TOther is not supported.

OverflowException

value is not representable by NumericOption<T>.

| Edit this page View Source

CreateSaturating<TOther>(TOther)

Creates an instance of the current type from a value, saturating any values that fall outside the representable range of the current type.

Declaration
public static NumericOption<T> CreateSaturating<TOther>(TOther value) where TOther : INumberBase<TOther>
Parameters
Type Name Description
TOther value

The value which is used to create the instance of NumericOption<T>.

Returns
Type Description
NumericOption<T>

An instance of NumericOption<T> created from value, saturating if value falls outside the representable range of NumericOption<T>.

Type Parameters
Name Description
TOther

The type of value.

Exceptions
Type Condition
NotSupportedException

TOther is not supported.

| Edit this page View Source

CreateTruncating<TOther>(TOther)

Creates an instance of the current type from a value, truncating any values that fall outside the representable range of the current type.

Declaration
public static NumericOption<T> CreateTruncating<TOther>(TOther value) where TOther : INumberBase<TOther>
Parameters
Type Name Description
TOther value

The value which is used to create the instance of NumericOption<T>.

Returns
Type Description
NumericOption<T>

An instance of NumericOption<T> created from value, truncating if value falls outside the representable range of NumericOption<T>.

Type Parameters
Name Description
TOther

The type of value.

Exceptions
Type Condition
NotSupportedException

TOther is not supported.

| Edit this page View Source

Equals(NumericOption<T>)

Indicates whether the current object is equal to another object of the same type.

Declaration
public bool Equals(NumericOption<T> other)
Parameters
Type Name Description
NumericOption<T> other

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the other parameter; otherwise, false.

| Edit this page View Source

Equals(object?)

Indicates whether the current object is equal to another object.

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
object obj

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the obj parameter; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

GetEnumerator()

Returns an enumerator for the option.

Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type Description
IEnumerator<T>

The enumerator.

| Edit this page View Source

GetHashCode()

Retrieves the hash code of the object contained by the Option<T>, if any.

Declaration
public override int GetHashCode()
Returns
Type Description
int

The hash code of the object returned by the IsSome(out T) method, if that method returns true, or zero if it returns false.

Overrides
ValueType.GetHashCode()
| Edit this page View Source

IsEvenInteger(NumericOption<T>)

Determines if a value represents an even integral number.

Declaration
public static bool IsEvenInteger(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is an even integer; otherwise, false.

| Edit this page View Source

IsInfinity(NumericOption<T>)

Determines if a value is infinite.

Declaration
public static bool IsInfinity(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is infinite; otherwise, false.

| Edit this page View Source

IsNaN(NumericOption<T>)

Determines if a value is NaN.

Declaration
public static bool IsNaN(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is NaN; otherwise, false.

| Edit this page View Source

IsNegative(NumericOption<T>)

Determines if a value is negative.

Declaration
public static bool IsNegative(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is negative; otherwise, false.

| Edit this page View Source

IsNegativeInfinity(NumericOption<T>)

Determines if a value is negative infinity.

Declaration
public static bool IsNegativeInfinity(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is negative infinity; otherwise, false.

| Edit this page View Source

IsOddInteger(NumericOption<T>)

Determines if a value represents an odd integral number.

Declaration
public static bool IsOddInteger(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is an odd integer; otherwise, false.

| Edit this page View Source

IsPositive(NumericOption<T>)

Determines if a value is positive.

Declaration
public static bool IsPositive(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is positive; otherwise, false.

| Edit this page View Source

IsPositiveInfinity(NumericOption<T>)

Determines if a value is positive infinity.

Declaration
public static bool IsPositiveInfinity(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is positive infinity; otherwise, false.

| Edit this page View Source

IsSome(out T)

Returns true if the option is Some, and returns the contained value through value.

Declaration
public bool IsSome(out T value)
Parameters
Type Name Description
T value

The value contained in the option.

Returns
Type Description
bool

true if the option is Some.

| Edit this page View Source

IsZero(NumericOption<T>)

Determines if a value is zero.

Declaration
public static bool IsZero(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to be checked.

Returns
Type Description
bool

true if value is zero; otherwise, false.

| Edit this page View Source

Match(Action<T>, Action)

If the option is Some, passes the contained value to the onSome function. Otherwise calls the onNone function.

Declaration
public void Match(Action<T> onSome, Action onNone)
Parameters
Type Name Description
Action<T> onSome

The function to call with the contained Some value, if any.

Action onNone

The function to call if the option is None.

Exceptions
Type Condition
ArgumentNullException

Thrown if either onSome or onNone is null.

| Edit this page View Source

Match<T2>(Func<T, T2>, Func<T2>)

Returns the result of executing the onSome or onNone functions, depending on the state of the Option<T>.

Declaration
public T2 Match<T2>(Func<T, T2> onSome, Func<T2> onNone)
Parameters
Type Name Description
Func<T, T2> onSome

The function to pass the value to, if the result is Ok.

Func<T2> onNone

The function to pass the error value to, if the result is Err.

Returns
Type Description
T2

The value returned by the called function.

Type Parameters
Name Description
T2

The return type of the given functions.

Exceptions
Type Condition
ArgumentNullException

Thrown if either onSome or onNone is null.

| Edit this page View Source

Max(NumericOption<T>, NumericOption<T>)

Compares two values to compute which is greater.

Declaration
public static NumericOption<T> Max(NumericOption<T> x, NumericOption<T> y)
Parameters
Type Name Description
NumericOption<T> x

The value to compare with y.

NumericOption<T> y

The value to compare with x.

Returns
Type Description
NumericOption<T>

x if it is greater than y; otherwise, y.

| Edit this page View Source

Min(NumericOption<T>, NumericOption<T>)

Compares two values to compute which is lesser.

Declaration
public static NumericOption<T> Min(NumericOption<T> x, NumericOption<T> y)
Parameters
Type Name Description
NumericOption<T> x

The value to compare with y.

NumericOption<T> y

The value to compare with x.

Returns
Type Description
NumericOption<T>

x if it is less than y; otherwise, y.

| Edit this page View Source

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

Parses a span of characters into a value.

Declaration
public static NumericOption<T> Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider)
Parameters
Type Name Description
ReadOnlySpan<char> s

The span of characters to parse.

NumberStyles style

A bitwise combination of number styles that can be present in s.

IFormatProvider provider

An object that provides culture-specific formatting information about s.

Returns
Type Description
NumericOption<T>

The result of parsing s.

Exceptions
Type Condition
ArgumentException

style is not a supported NumberStyles value.

FormatException

s is not in the correct format.

OverflowException

s is not representable by NumericOption<T>.

| Edit this page View Source

Parse(ReadOnlySpan<char>, IFormatProvider?)

Parses a span of characters into a value.

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

The span of characters to parse.

IFormatProvider provider

An object that provides culture-specific formatting information about s.

Returns
Type Description
NumericOption<T>

The result of parsing s.

Exceptions
Type Condition
FormatException

s is not in the correct format.

OverflowException

s is not representable by NumericOption<T>.

| Edit this page View Source

Parse(string, NumberStyles, IFormatProvider?)

Parses a string into a value.

Declaration
public static NumericOption<T> Parse(string s, NumberStyles style, IFormatProvider? provider)
Parameters
Type Name Description
string s

The string to parse.

NumberStyles style

A bitwise combination of number styles that can be present in s.

IFormatProvider provider

An object that provides culture-specific formatting information about s.

Returns
Type Description
NumericOption<T>

The result of parsing s.

Exceptions
Type Condition
ArgumentException

style is not a supported NumberStyles value.

ArgumentNullException

s is null.

FormatException

s is not in the correct format.

OverflowException

s is not representable by NumericOption<T>.

| Edit this page View Source

Parse(string, IFormatProvider?)

Parses a string into a value.

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

The string to parse.

IFormatProvider provider

An object that provides culture-specific formatting information about s.

Returns
Type Description
NumericOption<T>

The result of parsing s.

Exceptions
Type Condition
ArgumentNullException

s is null.

FormatException

s is not in the correct format.

OverflowException

s is not representable by NumericOption<T>.

| Edit this page View Source

ToString()

Returns the text representation of the value of the current Option<T> object.

Declaration
public override string ToString()
Returns
Type Description
string

The text representation of the value of the current Option<T> object.

Overrides
ValueType.ToString()
| Edit this page View Source

ToString(string?, IFormatProvider?)

Formats the value of the current Option<T> using the specified format.

Declaration
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
Type Name Description
string format

The format to use, or a null reference to use the default format defined for the type of the contained value.

IFormatProvider formatProvider

The provider to use to format the value, or a null reference to obtain the format information from the current locale setting of the operating system.

Returns
Type Description
string

The value of the current instance in the specified format.

| Edit this page View Source

TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)

Tries to format the value of the current instance into the provided span of characters.

Declaration
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
Parameters
Type Name Description
Span<char> destination

The span in which to write this instance's value formatted as a span of characters.

int charsWritten

When this method returns, contains the number of characters that were written in destination.

ReadOnlySpan<char> format

A span containing the characters that represent a standard or custom format string that defines the acceptable format for destination.

IFormatProvider provider

An optional object that supplies culture-specific formatting information for destination.

Returns
Type Description
bool

true if the formatting was successful; otherwise, false.

| Edit this page View Source

Unwrap()

Returns the contained Some value, or throws an InvalidOperationException if the value is None.

Declaration
public T Unwrap()
Returns
Type Description
T

The value contained in the option.

Exceptions
Type Condition
InvalidOperationException

Thrown if the option does not contain a value.

Operators

| Edit this page View Source

operator +(NumericOption<T>, NumericOption<T>)

Adds two values together to compute their sum.

Declaration
public static NumericOption<T> operator +(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The value to which right is added.

NumericOption<T> right

The value which is added to left.

Returns
Type Description
NumericOption<T>

The sum of left and right.

| Edit this page View Source

operator --(NumericOption<T>)

Decrements a value.

Declaration
public static NumericOption<T> operator --(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to decrement.

Returns
Type Description
NumericOption<T>

The result of decrementing value.

| Edit this page View Source

operator /(NumericOption<T>, NumericOption<T>)

Divides one value by another to compute their quotient.

Declaration
public static NumericOption<T> operator /(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The value which right divides.

NumericOption<T> right

The value which divides left.

Returns
Type Description
NumericOption<T>

The quotient of left divided by right.

| Edit this page View Source

operator ==(NumericOption<T>, NumericOption<T>)

Determines whether one Option is equal to another Option.

Declaration
public static bool operator ==(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The first Option to compare.

NumericOption<T> right

The second Option to compare.

Returns
Type Description
bool

true if the two values are equal.

| Edit this page View Source

operator >(NumericOption<T>, NumericOption<T>)

Determines whether one Option is greater than another Option.

Declaration
public static bool operator >(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The first Option to compare.

NumericOption<T> right

The second Option to compare.

Returns
Type Description
bool

true if the left parameter is greater than the right parameter.

| Edit this page View Source

operator >=(NumericOption<T>, NumericOption<T>)

Determines whether one Option is greater than or equal to another Option.

Declaration
public static bool operator >=(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The first Option to compare.

NumericOption<T> right

The second Option to compare.

Returns
Type Description
bool

true if the left parameter is greater than or equal to the right parameter.

| Edit this page View Source

implicit operator Option<T>(NumericOption<T>)

Converts a NumericOption<T> into an Option<T>.

Declaration
public static implicit operator Option<T>(NumericOption<T> self)
Parameters
Type Name Description
NumericOption<T> self

The numeric option to convert.

Returns
Type Description
Option<T>
| Edit this page View Source

implicit operator NumericOption<T>(Option<T>)

Implicitly converts Option<T> into NumericOption<T>, provided that T is compatible with NumericOption.

Declaration
public static implicit operator NumericOption<T>(Option<T> option)
Parameters
Type Name Description
Option<T> option

The option to convert.

Returns
Type Description
NumericOption<T>
| Edit this page View Source

implicit operator NumericOption<T>(T)

Implicitly converts a T into a NumericOption<T>.

Declaration
public static implicit operator NumericOption<T>(T value)
Parameters
Type Name Description
T value

The value to wrap in a NumericOption<T>.

Returns
Type Description
NumericOption<T>
| Edit this page View Source

operator ++(NumericOption<T>)

Increments a value.

Declaration
public static NumericOption<T> operator ++(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value to increment.

Returns
Type Description
NumericOption<T>

The result of incrementing value.

| Edit this page View Source

operator !=(NumericOption<T>, NumericOption<T>)

Determines whether one Option is not equal to another Option.

Declaration
public static bool operator !=(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The first Option to compare.

NumericOption<T> right

The second Option to compare.

Returns
Type Description
bool

true if the two values are not equal.

| Edit this page View Source

operator <(NumericOption<T>, NumericOption<T>)

Determines whether one Option is less than another Option.

Declaration
public static bool operator <(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The first Option to compare.

NumericOption<T> right

The second Option to compare.

Returns
Type Description
bool

true if the left parameter is less than the right parameter.

| Edit this page View Source

operator <=(NumericOption<T>, NumericOption<T>)

Determines whether one Option is less than or equal to another Option.

Declaration
public static bool operator <=(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The first Option to compare.

NumericOption<T> right

The second Option to compare.

Returns
Type Description
bool

true if the left parameter is less than or equal to the right parameter.

| Edit this page View Source

operator %(NumericOption<T>, NumericOption<T>)

Divides two values together to compute their modulus or remainder.

Declaration
public static NumericOption<T> operator %(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The value which right divides.

NumericOption<T> right

The value which divides left.

Returns
Type Description
NumericOption<T>

The modulus or remainder of left divided by right.

| Edit this page View Source

operator *(NumericOption<T>, NumericOption<T>)

Multiplies two values together to compute their product.

Declaration
public static NumericOption<T> operator *(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The value which right multiplies.

NumericOption<T> right

The value which multiplies left.

Returns
Type Description
NumericOption<T>

The product of left divided by right.

| Edit this page View Source

operator -(NumericOption<T>, NumericOption<T>)

Subtracts two values to compute their difference.

Declaration
public static NumericOption<T> operator -(NumericOption<T> left, NumericOption<T> right)
Parameters
Type Name Description
NumericOption<T> left

The value from which right is subtracted.

NumericOption<T> right

The value which is subtracted from left.

Returns
Type Description
NumericOption<T>

The value of right subtracted from left.

| Edit this page View Source

operator -(NumericOption<T>)

Computes the unary negation of a value.

Declaration
public static NumericOption<T> operator -(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value for which to compute the unary negation.

Returns
Type Description
NumericOption<T>

The unary negation of value.

| Edit this page View Source

operator +(NumericOption<T>)

Computes the unary plus of a value.

Declaration
public static NumericOption<T> operator +(NumericOption<T> value)
Parameters
Type Name Description
NumericOption<T> value

The value for which to compute the unary plus.

Returns
Type Description
NumericOption<T>

The unary plus of value.

Implements

INumber<TSelf>
IComparable
IComparable<T>
IComparisonOperators<TSelf, TOther, TResult>
IModulusOperators<TSelf, TOther, TResult>
INumberBase<TSelf>
IEquatable<T>
ISpanParsable<TSelf>
IParsable<TSelf>
IAdditionOperators<TSelf, TOther, TResult>
IAdditiveIdentity<TSelf, TResult>
IDecrementOperators<TSelf>
IDivisionOperators<TSelf, TOther, TResult>
IEqualityOperators<TSelf, TOther, TResult>
IIncrementOperators<TSelf>
IMultiplicativeIdentity<TSelf, TResult>
IMultiplyOperators<TSelf, TOther, TResult>
ISubtractionOperators<TSelf, TOther, TResult>
IUnaryNegationOperators<TSelf, TResult>
IUnaryPlusOperators<TSelf, TResult>
ISpanFormattable
IFormattable

Extension Methods

NumericOptionExtensions.AndThen<T1, T2>(NumericOption<T1>, Func<T1, NumericOption<T2>>)
NumericOptionExtensions.And<T1, T2>(NumericOption<T1>, NumericOption<T2>)
NumericOptionExtensions.Expect<T>(NumericOption<T>, string)
NumericOptionExtensions.Filter<T>(NumericOption<T>, Func<T, bool>)
NumericOptionExtensions.MapOrElse<T1, T2>(NumericOption<T1>, Func<T1, T2>, Func<T2>)
NumericOptionExtensions.MapOr<T1, T2>(NumericOption<T1>, Func<T1, T2>, T2)
NumericOptionExtensions.Map<T1, T2>(NumericOption<T1>, Func<T1, T2>)
NumericOptionExtensions.NoneNumeric<T>(T)
NumericOptionExtensions.OrElse<T>(NumericOption<T>, Func<NumericOption<T>>)
NumericOptionExtensions.Or<T>(NumericOption<T>, NumericOption<T>)
NumericOptionExtensions.SomeNumeric<T>(T)
NumericOptionExtensions.UnwrapOrElse<T>(NumericOption<T>, Func<T>)
NumericOptionExtensions.UnwrapOr<T>(NumericOption<T>, T)
NumericOptionExtensions.Xor<T>(NumericOption<T>, NumericOption<T>)
NumericOptionExtensions.ZipWith<T1, T2, T3>(NumericOption<T1>, NumericOption<T2>, Func<T1, T2, T3>)
OptionExtensions.None<T>(T)
OptionExtensions.Some<T>(T)
OptionResultExtensions.OkOrElse<T, TErr>(NumericOption<T>, Func<TErr>)
OptionResultExtensions.OkOr<T, TErr>(NumericOption<T>, TErr)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX