/// <summary> /// Constructs a new optional using the some value safety /// </summary> /// <param name="value"></param> public Option(Some <TVal> value) { this._value = value; this.HasValue = true; _initialized = true; }
/// <inheritdoc /> public bool Equals(Some <TVal> other) => EqualityComparer <TVal> .Default.Equals(_value, other._value) && _initialized == other._initialized;
/// <summary> /// Return the value if present or a fixed default /// </summary> /// <param name="default"></param> /// <returns></returns> public TVal SomeOrDefault(Some <TVal> @default) => this.HasValue ? this._value : ~@default;