Skip to content

Commit 5051994

Browse files
committed
Reuse XML comments
1 parent 8ec4c63 commit 5051994

File tree

2 files changed

+12
-51
lines changed

2 files changed

+12
-51
lines changed

src/DotNext/Optional.cs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -771,27 +771,12 @@ public bool Equals(object? other, IEqualityComparer comparer)
771771
_ => None
772772
};
773773

774-
/// <summary>
775-
/// Checks whether the container has value.
776-
/// </summary>
777-
/// <param name="optional">The container to check.</param>
778-
/// <returns><see langword="true"/> if this container has value; otherwise, <see langword="false"/>.</returns>
779-
/// <seealso cref="HasValue"/>
774+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_True"/>
780775
public static bool operator true(in Optional<T> optional) => optional.HasValue;
781776

782-
/// <summary>
783-
/// Checks whether the container has no value.
784-
/// </summary>
785-
/// <param name="optional">The container to check.</param>
786-
/// <returns><see langword="true"/> if this container has no value; otherwise, <see langword="false"/>.</returns>
787-
/// <seealso cref="HasValue"/>
777+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_False"/>
788778
public static bool operator false(in Optional<T> optional) => !optional;
789779

790-
/// <summary>
791-
/// Checks whether the container has no value.
792-
/// </summary>
793-
/// <param name="optional">The container to check.</param>
794-
/// <returns><see langword="true"/> if this container has no value; otherwise, <see langword="false"/>.</returns>
795-
/// <seealso cref="HasValue"/>
780+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_LogicalNot"/>
796781
public static bool operator !(in Optional<T> optional) => optional.kind < NotEmptyValue;
797782
}

src/DotNext/Result.cs

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -377,26 +377,14 @@ public ValueTask<T> AsTask()
377377
/// <returns><see langword="true"/> if both results are successful; otherwise, <see langword="false"/>.</returns>
378378
public static bool operator &(in Result<T> left, in Result<T> right) => left.exception is null && right.exception is null;
379379

380-
/// <summary>
381-
/// Indicates that the result represents error.
382-
/// </summary>
383-
/// <param name="result">The result to check.</param>
384-
/// <returns><see langword="false"/> if this result is successful; <see langword="true"/> if this result represents exception.</returns>
380+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_LogicalNot"/>
385381
public static bool operator !(in Result<T> result) => result.exception is not null;
386382

387-
/// <summary>
388-
/// Indicates that the result is successful.
389-
/// </summary>
390-
/// <param name="result">The result to check.</param>
391-
/// <returns><see langword="true"/> if this result is successful; <see langword="false"/> if this result represents exception.</returns>
383+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_True"/>
392384
public static bool operator true(in Result<T> result) => result.exception is null;
393385

394-
/// <summary>
395-
/// Indicates that the result represents error.
396-
/// </summary>
397-
/// <param name="result">The result to check.</param>
398-
/// <returns><see langword="false"/> if this result is successful; <see langword="true"/> if this result represents exception.</returns>
399-
public static bool operator false(in Result<T> result) => result.exception is not null;
386+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_False"/>
387+
public static bool operator false(in Result<T> result) => !result;
400388

401389
/// <summary>
402390
/// Returns textual representation of this object.
@@ -708,24 +696,12 @@ public unsafe T OrThrow(delegate*<TError, Exception> exceptionFactory)
708696
/// <returns><see langword="true"/> if both results are successful; otherwise, <see langword="false"/>.</returns>
709697
public static bool operator &(in Result<T, TError> left, in Result<T, TError> right) => left.IsSuccessful && right.IsSuccessful;
710698

711-
/// <summary>
712-
/// Indicates that the result represents error.
713-
/// </summary>
714-
/// <param name="result">The result to check.</param>
715-
/// <returns><see langword="false"/> if this result is successful; <see langword="true"/> if this result represents exception.</returns>
699+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_LogicalNot"/>
716700
public static bool operator !(in Result<T, TError> result) => !result.IsSuccessful;
717701

718-
/// <summary>
719-
/// Indicates that the result is successful.
720-
/// </summary>
721-
/// <param name="result">The result to check.</param>
722-
/// <returns><see langword="true"/> if this result is successful; <see langword="false"/> if this result represents exception.</returns>
702+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_True"/>
723703
public static bool operator true(in Result<T, TError> result) => result.IsSuccessful;
724-
725-
/// <summary>
726-
/// Indicates that the result represents error.
727-
/// </summary>
728-
/// <param name="result">The result to check.</param>
729-
/// <returns><see langword="false"/> if this result is successful; <see langword="true"/> if this result represents exception.</returns>
730-
public static bool operator false(in Result<T, TError> result) => !result.IsSuccessful;
704+
705+
/// <inheritdoc cref="IOptionMonad{T,TSelf}.op_False"/>
706+
public static bool operator false(in Result<T, TError> result) => !result;
731707
}

0 commit comments

Comments
 (0)