/// <summary>Removes a value.</summary> /// <typeparam name="T">The type of value.</typeparam> /// <typeparam name="K">The type of the keys.</typeparam> /// <param name="trie">The trie to remove the value from.</param> /// <param name="stepper">The keys to store the value relative to.</param> public static void Remove <K, T>(this ITrie <K, T> trie, Stepper <K> stepper) { if (!trie.TryRemove(stepper, out Exception exception)) { throw exception; } }
/// <summary>Removes a value.</summary> /// <typeparam name="T">The type of value.</typeparam> /// <typeparam name="TData">The type of the data.</typeparam> /// <param name="trie">The trie to remove the value from.</param> /// <param name="stepper">The keys to store the value relative to.</param> public static void Remove <T, TData>(this ITrie <T, TData> trie, Action <Action <T> > stepper) { var(success, exception) = trie.TryRemove(stepper); if (!success) { throw exception ?? new ArgumentException($"{nameof(Remove)} failed but the {nameof(exception)} is null"); } }
/// <summary>Tries to removes a value.</summary> /// <typeparam name="T">The type of value.</typeparam> /// <typeparam name="K">The type of the keys.</typeparam> /// <param name="trie">The trie to remove the value from.</param> /// <param name="stepper">The keys of the relative value.</param> /// <returns>True if the remove was successful or false if not.</returns> public static bool TryRemove <K, T>(this ITrie <K, T> trie, Stepper <K> stepper) => trie.TryRemove(stepper, out _);