// Copyright © WireMock.Net
using Stef.Validation;
namespace WireMock.Util;
///
/// Some IDictionary Extensions
///
public static class DictionaryExtensions
{
///
/// Loops the dictionary and executes the specified action.
///
/// The type of the key.
/// The type of the value.
/// The dictionary to loop (can be null).
/// The action.
public static void Loop(this IDictionary? dictionary, Action action)
where TKey : notnull
{
Guard.NotNull(action);
if (dictionary != null)
{
foreach (var entry in dictionary)
{
action(entry.Key, entry.Value);
}
}
}
}