Skip to content

Commit

Permalink
Add documentation comments for ReasonExtensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kysluss committed Jul 13, 2024
1 parent 3bc95d9 commit c6cfece
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/FluentResults/Reasons/ReasonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@
// ReSharper disable once CheckNamespace
namespace FluentResults
{
/// <summary>
/// Extensions for <see cref="IReason"/>
/// </summary>
public static class ReasonExtensions
{
/// <summary>
/// Check if a metadata key exists
/// </summary>
/// <param name="reason">The reason instance</param>
/// <param name="key">The metadata key</param>
/// <returns>True if the metadata key exists</returns>
/// <exception cref="ArgumentNullException"></exception>
public static bool HasMetadataKey(this IReason reason, string key)
{
if(string.IsNullOrEmpty(key))
Expand All @@ -13,6 +23,14 @@ public static bool HasMetadataKey(this IReason reason, string key)
return reason.Metadata.ContainsKey(key);
}

/// <summary>
/// Check if a metadata key exists and matches the supplied predicate
/// </summary>
/// <param name="reason">The reason instance</param>
/// <param name="key">The metadata key</param>
/// <param name="predicate">The predicate to check if the metadata key exists</param>
/// <returns>True if the metadata value matches the predicate</returns>
/// <exception cref="ArgumentNullException"></exception>
public static bool HasMetadata(this IReason reason, string key, Func<object, bool> predicate)
{
if (string.IsNullOrEmpty(key))
Expand Down

0 comments on commit c6cfece

Please sign in to comment.