Ejemplo n.º 1
0
 /// <summary>Removes a value.</summary>
 /// <typeparam name="T">The type of value.</typeparam>
 /// <param name="structure">The structure to remove the value from.</param>
 /// <param name="value">The value to be removed.</param>
 public static void Remove <T>(this IRemovable <T> structure, T value)
 {
     if (!structure.TryRemove(value, out Exception exception))
     {
         throw exception;
     }
 }
Ejemplo n.º 2
0
 /// <summary>Removes a value.</summary>
 /// <typeparam name="T">The type of value.</typeparam>
 /// <param name="structure">The structure to remove the value from.</param>
 /// <param name="value">The value to be removed.</param>
 public static void Remove <T>(this IRemovable <T> structure, T value)
 {
     if (!structure.TryRemove(value, out Exception? exception))
     {
         throw exception ?? new ArgumentException(nameof(exception), $"{nameof(Remove)} failed but the {nameof(exception)} is null");;
     }
 }
Ejemplo n.º 3
0
 /// <summary>Removes a value from a data structure.</summary>
 /// <typeparam name="T">The type of values stored in this data structure.</typeparam>
 /// <param name="removable">The data structure to removable the value from.</param>
 /// <param name="value">The value to remove from the data structure.</param>
 public static void Remove <T>(this IRemovable <T> removable, T value)
 {
     var(success, exception) = removable.TryRemove(value);
     if (!success)
     {
         throw exception ?? new ArgumentException($"{nameof(Remove)} failed but the {nameof(exception)} is null");
     }
 }
Ejemplo n.º 4
0
 /// <summary>Tries to removes a value.</summary>
 /// <typeparam name="T">The type of value.</typeparam>
 /// <param name="structure">The structure to remove the value from.</param>
 /// <param name="value">The value to be removed.</param>
 /// <returns>True if the remove was successful or false if not.</returns>
 public static bool TryRemove <T>(this IRemovable <T> structure, T value)
 {
     return(structure.TryRemove(value, out _));
 }