diff --git a/src/Discord.Net/API/Optional.cs b/src/Discord.Net/API/Optional.cs index 0fe96071c..b828608b2 100644 --- a/src/Discord.Net/API/Optional.cs +++ b/src/Discord.Net/API/Optional.cs @@ -9,7 +9,7 @@ namespace Discord.API { private readonly T _value; - /// Gets the value for this paramter, or default(T) if unspecified. + /// Gets the value for this paramter. public T Value { get @@ -22,8 +22,6 @@ namespace Discord.API /// Returns true if this value has been specified. public bool IsSpecified { get; } - object IOptional.Value => _value; - /// Creates a new Parameter with the provided value. public Optional(T value) { @@ -40,12 +38,14 @@ namespace Discord.API if (other == null) return false; return _value.Equals(other); } - public override int GetHashCode() => IsSpecified ? _value.GetHashCode() : 0; + public override string ToString() => IsSpecified ? _value?.ToString() : null; private string DebuggerDisplay => IsSpecified ? _value.ToString() : ""; public static implicit operator Optional(T value) => new Optional(value); public static explicit operator T(Optional value) => value.Value; + + object IOptional.Value => Value; } }