Struct Optionable<T>
public readonly struct Optionable<T> : IEquatable<Optionable<T>> where T : struct
Type Parameters
T
- Implements
-
IEquatable<Optionable<T>>
- Inherited Members
- Extension Methods
Properties
IsNone
public bool IsNone { get; }
Property Value
IsSome
public bool IsSome { get; }
Property Value
None
public static Optionable<T> None { get; }
Property Value
- Optionable<T>
Value
public T Value { get; }
Property Value
- T
Methods
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
Equals(Optionable<T>)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Optionable<T> other)
Parameters
other
Optionable<T>An object to compare with this object.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
NoneWithValue(T)
public static Optionable<T> NoneWithValue(T value)
Parameters
value
T
Returns
- Optionable<T>
Some(T)
public static Optionable<T> Some(T value)
Parameters
value
T
Returns
- Optionable<T>
ValueOr(T)
public T ValueOr(T other)
Parameters
other
T
Returns
- T
Operators
operator ==(Optionable<T>, Optionable<T>)
public static bool operator ==(Optionable<T> left, Optionable<T> right)
Parameters
left
Optionable<T>right
Optionable<T>
Returns
operator !=(Optionable<T>, Optionable<T>)
public static bool operator !=(Optionable<T> left, Optionable<T> right)
Parameters
left
Optionable<T>right
Optionable<T>