@@ -36,6 +36,13 @@ public TResult Match<TResult>(Func<T, TResult> onSome, Func<TResult> onNone) =>
3636 _ => throw new InvalidOperationException ( "It should not be possible to reach this point." )
3737 } ;
3838
39+ /// <summary>
40+ /// Determines whether the specified object is equal to the current <see cref="Option{T}" />.
41+ /// </summary>
42+ /// <param name="obj">The object to compare with the current instance.</param>
43+ /// <returns>
44+ /// <c>true</c> if the specified object is equal to the current instance; otherwise, <c>false</c>.
45+ /// </returns>
3946 public override bool Equals ( object ? obj )
4047 {
4148 if ( obj is Option < T > other )
@@ -51,6 +58,14 @@ public override bool Equals(object? obj)
5158 return false ;
5259 }
5360
61+ /// <summary>
62+ /// Returns a hash code for the current instance of the <see cref="Option{T}" />.
63+ /// For <see cref="Option{T}.Some" />, the hash code is computed based on its type and value.
64+ /// For <see cref="Option{T}.None" />, the hash code is derived from its type.
65+ /// </summary>
66+ /// <returns>
67+ /// An integer representing the hash code of the current instance.
68+ /// </returns>
5469 public override int GetHashCode ( ) =>
5570 this switch
5671 {
@@ -59,8 +74,24 @@ public override int GetHashCode() =>
5974 _ => 0
6075 } ;
6176
62- // Add equality operators
77+ /// <summary>
78+ /// Determines whether two <see cref="Option{T}" /> instances are equal at a value level.
79+ /// </summary>
80+ /// <param name="left">The first <see cref="Option{T}" /> instance to compare.</param>
81+ /// <param name="right">The second <see cref="Option{T}" /> instance to compare.</param>
82+ /// <returns>
83+ /// True if the two <see cref="Option{T}" /> instances are considered equal; otherwise, false.
84+ /// </returns>
6385 public static bool operator == ( Option < T > left , Option < T > right ) => left . Equals ( right ) ;
86+
87+ /// <summary>
88+ /// Determines whether two <see cref="Option{T}" /> instances are not equal at a value level.
89+ /// </summary>
90+ /// <param name="left">The first <see cref="Option{T}" /> instance to compare.</param>
91+ /// <param name="right">The second <see cref="Option{T}" /> instance to compare.</param>
92+ /// <returns>
93+ /// <c>true</c> if the two instances are not equal; otherwise, <c>false</c>.
94+ /// </returns>
6495 public static bool operator != ( Option < T > left , Option < T > right ) => ! left . Equals ( right ) ;
6596
6697 /// <summary>
0 commit comments